<?php
/**
 * @Author: king
 * @Last Modified by:   king
 * Date: 2018/7/30
 * Time: 11:29
 */

namespace App\Http\Controllers\Api\v1\Everyday;


use App\Http\Controllers\Controller;

class SuitableController extends Controller
{
    // 行运数据
    public $transitsData = [];
    // 三限数据
    public $thirdprogressedData = [];

    public $nowData = [];
    public $natalData = [];
    public $time = 0;
    public $birthtime = 0;
    public $sunDeg = -1;
    protected $keywords = [];

    public function init($index = false)
    {
        $this->keywords = [];

        $this->getKeywords();

        $result = $this->keywords;

        $result = resort($result,'per','DESC');

        $res = [];
        //日运页
        //仅显示大于等于3的
        //如没有大于等于3的，显示得分最高的两条
        //
        //首页
        //仅显示1-2条：如无大于等于3的或大于等于3的只有一条，仅显示最高分一条；否则显示最高的两条
        $count_gt_3 = 0;

        foreach ($result as $r)
        {
            $res[] = $r['text'];

            if($r['per'] >= 3)
            {
                $count_gt_3++;
            }
        }

        if($index === false)
        {
            if($count_gt_3 >= 1)
            {
                $res = array_slice($res,0,$count_gt_3);
            }
            else
            {
                $res = array_slice($res,0,2);
            }
        }
        else
        {
            if($count_gt_3 <= 1)
            {
                $res = array_slice($res,0,1);
            }
            else
            {
                $res = array_slice($res,0,2);
            }
        }

        return $res;
    }

    /**
     * 获取宜-关键词
     */
    protected function getKeywords()
    {
        $this->getKeywordsByHouse1();
        $this->getKeywordsByHouse2();
        $this->getKeywordsByHouse3();
        $this->getKeywordsByHouse4();
        $this->getKeywordsByHouse5();
        $this->getKeywordsByHouse6();
        $this->getKeywordsByHouse7();
        $this->getKeywordsByHouse8();
        $this->getKeywordsByHouse9();
        $this->getKeywordsByHouse10();
        $this->getKeywordsByHouse11();
        $this->getKeywordsByHouse12();
        $this->getKeywordsByOthers();
    }

    protected function getKeywordsByHouse1()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $tx_planet = $this->nowData['planets'];// 天象数据

        # 履行新计划
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tr月亮过一宫+3
        if($tr_planet[1]['in_house_id'] == 1)
        {
            $score_1_tr += 3;
        }
        // tx日月合+1
        if(isset($tx_planet[0]['phase']['0-1']) && $tx_planet[0]['phase']['0-1']['phase_e'] == 0)
        {
            $score_1_tx += 1;
        }
        // tr月火成相+1
        if(isset($tr_planet[1]['phase']['1-4']))
        {
            $score_1_tr += 1;
        }
        // tx月亮白羊座+1
        if($tx_planet[1]['in_sign_id'] == 1)
        {
            $score_1_tx += 1;
        }
        // tr月天成相+1
        if(isset($tr_planet[1]['phase']['1-7']))
        {
            $score_1_tr += 1;
        }
        // tp月亮一宫+2
        if($tp_planet[1]['in_house_id'] == 1)
        {
            $score_1_tp += 2;
        }

        # 调节身心
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tr月亮一宫+3
        if($tr_planet[1]['in_house_id'] == 1)
        {
            $score_2_tr += 3;
        }
        // tp月亮一宫+2
        if($tp_planet[1]['in_house_id'] == 1)
        {
            $score_2_tp += 2;
        }
        // tr月火、tr月天、tr月水   无相位+2
        if(!isset($tr_planet[1]['phase']['1-2'])
            && !isset($tr_planet[1]['phase']['1-4'])
            && !isset($tr_planet[1]['phase']['1-7']))
        {
            $score_2_tr += 2;
        }
        // tx月亮金牛、水瓶、双鱼、巨蟹、天蝎+1
        if($tx_planet[1]['in_sign_id'] == 2
            || $tx_planet[1]['in_sign_id'] == 4
            || $tx_planet[1]['in_sign_id'] == 8
            || $tx_planet[1]['in_sign_id'] == 11
            || $tx_planet[1]['in_sign_id'] == 12)
        {
            $score_2_tx += 1;
        }
        // tr月金+1
        if(isset($tr_planet[1]['phase']['1-3']))
        {
            $score_2_tr += 1;
        }

        # 整理关系
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        $is_phase_7_180 = $is_phase_3 = $is_phase_2_7 = false;
        if($tr_planet[1]['in_house_id'] == 1)
        {
            if(!empty($tr_planet[1]['phase']))
            {
                foreach ($tr_planet[1]['phase'] as $phase1)
                {
                    if($phase1['phase_e'] == 180
                        && $this->transitsData[0]['planets'][$phase1['id']]['in_house_id'] == 7)
                    {
                        $is_phase_7_180 = true;
                    }
                    if($phase1['id'] == 3)
                    {
                        $is_phase_3 = true;
                    }
                    if($phase1['id'] == 2 || $phase1['id'] == 7)
                    {
                        $is_phase_2_7 = true;
                    }
                }
            }
        }
        // tr月亮过一宫且与7宫内星对冲+3【tp+2】
        if($is_phase_7_180 === true)
        {
            $score_3_tr += 3;
            $score_3_tp += 2;
        }
        // tr月亮过一宫且与金星成相+2【tp+1.5】
        if($is_phase_3 === true)
        {
            $score_3_tr += 2;
            $score_3_tp += 1.5;
        }
        // tr月亮过一宫且与水星或天王成相+2【tp+1】
        if($is_phase_2_7 === true)
        {
            $score_3_tr += 2;
            $score_3_tp += 1;
        }
        // tr月亮7宫+1，此时与天王成相+2，与海王成相+2
        if($tr_planet[1]['in_house_id'] == 7)
        {
            $score_3_tr += 1;
            if(isset($tr_planet[1]['phase']['1-7']))
            {
                $score_3_tr += 2;
            }
            if(isset($tr_planet[1]['phase']['1-8']))
            {
                $score_3_tr += 2;
            }
        }
        // tr水星7宫+0.5，金星7宫+0.7
        if($tr_planet[2]['in_house_id'] == 7)
        {
            $score_3_tr += 0.5;
        }
        if($tr_planet[3]['in_house_id'] == 7)
        {
            $score_3_tr += 0.7;
        }
        // tp月亮过7宫+0.6，此时与天王成相+0.7，此时金天成相+0.3，此时金海刑冲+0.3
        if($tp_planet[1]['in_house_id'] == 7)
        {
            $score_3_tp += 0.6;
            if(isset($tp_planet[1]['phase']['1-7']))
            {
                $score_3_tp += 0.7;
            }
            if(isset($tp_planet[3]['phase']['3-7']))
            {
                $score_3_tp += 0.3;
            }
            if(isset($tp_planet[3]['phase']['3-8'])
                && in_array($tp_planet[3]['phase']['3-8']['phase_e'],[90,180]))
            {
                $score_3_tp += 0.3;
            }
        }

        # 振作精神
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tr太阳合asc+3
        if(isset($tr_planet[0]['phase']['0-'.ASC]) && $tr_planet[0]['phase']['0-'.ASC]['phase_e'] == 0)
        {
            $score_4_tr += 3;
        }
        // tr太阳1宫合拱六分木星+2
        if($tr_planet[0]['in_house_id'] == 1
            && isset($tr_planet[0]['phase']['0-5'])
            && in_array($tr_planet[0]['phase']['0-5']['phase_e'],[0,60,120]))
        {
            $score_4_tr += 2;
        }

        #履行新计划
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #调节身心
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #整理关系
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #振作精神
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '履行新计划',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '调节身心',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '整理关系',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '振作精神',
            'per' => $score_4,
        ];
    }
    protected function getKeywordsByHouse2()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planets = $this->natalData['planets'];

        #数钱
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tr水星在二宫+1
        if($tr_planet[2]['in_house_id'] == 2)
        {
            $score_1_tr += 1;
        }
        // tr水星在8宫+1
        if($tr_planet[2]['in_house_id'] == 8)
        {
            $score_1_tr += 1;
        }
        // tr水星与金星或月亮成相+1
        if(isset($tr_planet[2]['phase']['2-3']) || isset($tr_planet[2]['phase']['2-1']))
        {
            $score_1_tr += 1;
        }
        // tr月亮二宫与水星成相+4
        if($tr_planet[1]['in_house_id'] == 2 && isset($tr_planet[1]['phase']['1-2']))
        {
            $score_1_tr += 4;
        }
        // tp月亮二宫与水星成相+2 20181011 改为+1
        if($tp_planet[1]['in_house_id'] == 2 && isset($tp_planet[1]['phase']['1-2']))
        {
            $score_1_tp += 1;
        }

        #收礼物
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tr金星二宫与金或月或水成相+2
        if($tr_planet[3]['in_house_id'] == 2 && (isset($tr_planet[3]['phase']['3-1']) || isset($tr_planet[3]['phase']['3-2'])))
        {
            $score_2_tr += 2;
        }
        // tr月亮二宫（或8宫）与金星成相+3，若同时与水或木成相+2
        if(isset($tr_planet[1]['phase']['1-3']) && ($tr_planet[1]['in_house_id'] == 2 || $tr_planet[1]['in_house_id'] == 8))
        {
            $score_2_tr += 3;
            if(isset($tr_planet[1]['phase']['1-2']) || isset($tr_planet[1]['phase']['1-5']))
            {
                $score_2_tr += 2;
            }
        }
        // tp月亮二宫（或8宫）与金星成相+1，若同时与水或木成相+1
        if(isset($tp_planet[1]['phase']['1-3']) && ($tp_planet[1]['in_house_id'] == 2 || $tp_planet[1]['in_house_id'] == 8))
        {
            $score_2_tp += 1;
            if(isset($tp_planet[1]['phase']['1-2']) || isset($tp_planet[1]['phase']['1-5']))
            {
                $score_2_tp += 1;
            }
        }

        #清理购物车
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tr金星2或8宫与火星成相+2，若此时有木星+1
        if(isset($tr_planet[3]['phase']['3-4']) && ($tr_planet[3]['in_house_id'] == 2 || $tr_planet[3]['in_house_id'] == 8))
        {
            $score_3_tr += 2;
            if(isset($tr_planet[3]['phase']['3-5']) || isset($tr_planet[3]['phase']['3-5']))
            {
                $score_3_tr += 1;
            }
        }
        // tr金星2或8宫与天王成相+2，若此时有木星+1
        if(isset($tr_planet[3]['phase']['3-7']) && ($tr_planet[3]['in_house_id'] == 2 || $tr_planet[3]['in_house_id'] == 8))
        {
            $score_3_tr += 2;
            if(isset($tr_planet[3]['phase']['3-5']) || isset($tr_planet[3]['phase']['3-5']))
            {
                $score_3_tr += 1;
            }
        }
        // tr月亮2或8宫与火星（或天王）成相+3，若此时有金星或水星成相+2 20181011 改为 +2 +1
        if((isset($tr_planet[1]['phase']['1-4']) || isset($tr_planet[1]['phase']['1-7'])) && ($tr_planet[1]['in_house_id'] == 2 || $tr_planet[1]['in_house_id'] == 8))
        {
            $score_3_tr += 2;
            if(isset($tr_planet[1]['phase']['1-3']) || isset($tr_planet[1]['phase']['1-2']))
            {
                $score_3_tr += 1;
            }
        }
        // tp月亮2或8宫与火星（或天王）成相+1，若此时有金星或水星成相+1
        if((isset($tp_planet[1]['phase']['1-4']) || isset($tp_planet[1]['phase']['1-7'])) && ($tp_planet[1]['in_house_id'] == 2 || $tp_planet[1]['in_house_id'] == 8))
        {
            $score_3_tp += 1;
            if(isset($tp_planet[1]['phase']['1-3']) || isset($tp_planet[1]['phase']['1-2']))
            {
                $score_3_tp += 1;
            }
        }
        // 本命金木或金火成相，tr日月金来成相本命金+3
        if(isset($na_planets[3]['phase']['3-4']) || isset($na_planets[3]['phase']['3-5']))
        {
            if(isset($tr_planet[0]['phase']['0-3']) || isset($tr_planet[1]['phase']['1-3']) || isset($tr_planet[3]['phase']['3-3']))
            {
                $score_3_tr += 3;
            }
        }

        #享受美食
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tr金星2宫+1
        if($tr_planet[3]['in_house_id'] == 2)
        {
            $score_4_tr += 1;
        }
        // tp金星2宫+1
        if($tp_planet[3]['in_house_id'] == 2)
        {
            $score_4_tp += 1;
        }
        // tr月亮2宫成相金星+3
        if($tr_planet[1]['in_house_id'] == 2 && isset($tr_planet[1]['phase']['2-3']))
        {
            $score_4_tr += 3;
        }
        // 本命太阳或月亮或火星在金牛座，或本命金月成相，tr日或月或金来与前面成立的星体成非邢相+3
        if(
            ($na_planets[0]['in_sign_id'] == 2 && (
                    (isset($tr_planet[0]['phase']['0-0']) && $tr_planet[0]['phase']['0-0']['phase_e'] != 90)
                    || (isset($tr_planet[1]['phase']['1-0']) && $tr_planet[1]['phase']['1-0']['phase_e'] != 90)
                    || (isset($tr_planet[3]['phase']['3-0']) && $tr_planet[3]['phase']['3-0']['phase_e'] != 90)
                ))
            ||
            ($na_planets[1]['in_sign_id'] == 2 && (
                    (isset($tr_planet[0]['phase']['0-1']) && $tr_planet[0]['phase']['0-1']['phase_e'] != 90)
                    || (isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] != 90)
                    || (isset($tr_planet[3]['phase']['3-1']) && $tr_planet[3]['phase']['3-1']['phase_e'] != 90)
                ))
            ||
            ($na_planets[4]['in_sign_id'] == 2 && (
                    (isset($tr_planet[0]['phase']['0-4']) && $tr_planet[0]['phase']['0-4']['phase_e'] != 90)
                    || (isset($tr_planet[1]['phase']['1-4']) && $tr_planet[1]['phase']['1-4']['phase_e'] != 90)
                    || (isset($tr_planet[3]['phase']['3-4']) && $tr_planet[3]['phase']['3-4']['phase_e'] != 90)
                ))
            ||
            (isset($na_planets[3]['phase']['3-1']) && (
                    (isset($tr_planet[0]['phase']['0-3']) && $tr_planet[0]['phase']['0-3']['phase_e'] != 90)
                    || (isset($tr_planet[1]['phase']['1-3']) && $tr_planet[1]['phase']['1-3']['phase_e'] != 90)
                    || (isset($tr_planet[3]['phase']['3-3']) && $tr_planet[3]['phase']['3-3']['phase_e'] != 90)
                    || (isset($tr_planet[0]['phase']['0-1']) && $tr_planet[0]['phase']['0-1']['phase_e'] != 90)
                    || (isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] != 90)
                    || (isset($tr_planet[3]['phase']['3-1']) && $tr_planet[3]['phase']['3-1']['phase_e'] != 90)
                ))
        )
        {
            $score_4_tr += 3;
        }

        #数钱
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #收礼物
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #清理购物车
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #享受美食
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '数钱',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '收礼物',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '清理购物车',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '享受美食',
            'per' => $score_4,
        ];
    }
    protected function getKeywordsByHouse3()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planets = $this->natalData['planets'];

        #读书学习
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tr水星3宫+1
        if($tr_planet[2]['in_house_id'] == 3)
        {
            $score_1_tr += 1;
        }
        // tr水星与土星或木星成相+1
        if(isset($tr_planet[2]['phase']['2-6']) || isset($tr_planet[2]['phase']['2-5']))
        {
            $score_1_tr += 1;
        }
        // tr月亮3宫成相水星+2，,若原局水星在水象或土象星座+2 ????
        if($tr_planet[1]['in_house_id'] == 3 && isset($tr_planet[1]['phase']['1-2']))
        {
            $score_1_tr += 2;
            if($na_planets[2]['in_sign_id']%2 == 0)
            {
                $score_1_tx += 2;
            }
        }
        // tr月亮3宫与土星成相+2
        if($tr_planet[1]['in_house_id'] == 3 && isset($tr_planet[1]['phase']['1-6']))
        {
            $score_1_tr += 2;
        }
        // tr月亮3宫与木星成相+1
        if($tr_planet[1]['in_house_id'] == 3 && isset($tr_planet[1]['phase']['1-5']))
        {
            $score_1_tr += 1;
        }
        // tp月亮3宫与水星成相+1
        if($tp_planet[1]['in_house_id'] == 3 && isset($tp_planet[1]['phase']['1-2']))
        {
            $score_1_tp += 1;
        }
        // tp月亮3宫与木星成相+1
        if($tp_planet[1]['in_house_id'] == 3 && isset($tp_planet[1]['phase']['1-5']))
        {
            $score_1_tp += 1;
        }

        #看电影
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tr水星3宫成相海王+2
        if($tr_planet[2]['in_house_id'] == 3 && isset($tr_planet[2]['phase']['2-8']))
        {
            $score_2_tr += 2;
        }
        // tr月亮3宫成相海王+2，此时tr月亮与金或水成相+2
        if($tr_planet[1]['in_house_id'] == 3 && isset($tr_planet[1]['phase']['1-8']))
        {
            $score_2_tr += 2;
            if(isset($tr_planet[1]['phase']['1-3']) || isset($tr_planet[1]['phase']['1-2']))
            {
                $score_2_tr += 2;
            }
        }
        // tp月亮3宫成相海王+1
        if($tp_planet[1]['in_house_id'] == 3 && isset($tp_planet[1]['phase']['1-8']))
        {
            $score_2_tp += 1;
        }

        #聊八卦
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tr水星3宫+1
        if($tr_planet[2]['in_house_id'] == 3)
        {
            $score_3_tr += 1;
        }
        // tr水星与木星成相+1
        if(isset($tr_planet[2]['phase']['2-5']))
        {
            $score_3_tr += 1;
        }
        // tr水星与月亮成相+1.5
        if(isset($tr_planet[2]['phase']['2-1']))
        {
            $score_3_tr += 1.5;
        }
        // tr水星与太阳成相+1
        if(isset($tr_planet[2]['phase']['2-0']))
        {
            $score_3_tr += 1;
        }
        // tr月亮3宫+1，此时与水星成相+2
        if($tr_planet[1]['in_house_id'] == 3)
        {
            $score_3_tr += 1;
            if(isset($tr_planet[1]['phase']['1-2']))
            {
                $score_3_tr += 2;
            }
        }
        // tr月亮3宫与木星或海王成相+1
        if($tr_planet[1]['in_house_id'] == 3 && (isset($tr_planet[1]['phase']['1-5']) || isset($tr_planet[1]['phase']['1-8'])))
        {
            $score_3_tr += 1;
        }
        // tp月亮在3宫+0.5，此时与水星成相+0.5,与海王成相+0.5
        if($tp_planet[1]['in_house_id'] == 3)
        {
            $score_3_tp += 0.5;
            if(isset($tp_planet[1]['phase']['1-2']))
            {
                $score_3_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-8']))
            {
                $score_3_tp += 0.5;
            }
        }
        // 本命水日月之一在双子座+0.5
        if($na_planets[0]['in_sign_id'] == 3 || $na_planets[1]['in_sign_id'] == 3 || $na_planets[2]['in_sign_id'] == 3)
        {
            $score_3_tx += 0.5;
        }

        #探亲访友
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tr火星3宫+0.5，金星3宫+1，水星3宫+0.5，太阳3宫+0.5，月亮3宫+0.5
        if($tr_planet[4]['in_house_id'] == 3)
        {
            $score_4_tr += 0.5;
        }
        if($tr_planet[3]['in_house_id'] == 3)
        {
            $score_4_tr += 1;
        }
        if($tr_planet[2]['in_house_id'] == 3)
        {
            $score_4_tr += 0.5;
        }
        if($tr_planet[0]['in_house_id'] == 3)
        {
            $score_4_tr += 0.5;
        }
        if($tr_planet[1]['in_house_id'] == 3)
        {
            $score_4_tr += 0.5;
        }
        // tr月亮与水火同时成相+3，此时成相金星+2
        if(isset($tr_planet[1]['phase']['1-2']) && isset($tr_planet[1]['phase']['1-4']))
        {
            $score_4_tr += 3;
            if(isset($tr_planet[1]['phase']['1-3']))
            {
                $score_4_tr += 2;
            }
        }
        // tr月亮在3宫（或4或7或11）与天王或木星或火星成相+2，此时成相金星+2
        if(in_array($tr_planet[1]['in_house_id'],[3,4,7,11]))
        {
            if(isset($tr_planet[1]['phase']['1-7']) || isset($tr_planet[1]['phase']['1-5']) || isset($tr_planet[1]['phase']['1-4']))
            {
                $score_4_tr += 2;
                if(isset($tr_planet[1]['phase']['1-3']))
                {
                    $score_4_tr += 2;
                }
            }
        }
        // tp月亮在3宫（或4/7/11）+0.5
        if(in_array($tp_planet[1]['in_house_id'],[3,4,7,11]))
        {
            $score_4_tp += 0.5;
        }
        // tp月亮与金星成相+1
        if(isset($tp_planet[1]['phase']['1-3']))
        {
            $score_4_tp += 1;
        }
        // tp月亮与水星成相+1
        if(isset($tp_planet[1]['phase']['1-2']))
        {
            $score_4_tp += 1;
        }

        #外出
        $score_5_tr = $score_5_tp = $score_5_tx = 0;
        // tr月亮与水火同时成相+3，此时成相木星或天王+2
        if(isset($tr_planet[1]['phase']['1-2']) && isset($tr_planet[1]['phase']['1-4']))
        {
            $score_5_tr += 3;
            if(isset($tr_planet[1]['phase']['1-5']) || isset($tr_planet[1]['phase']['1-7']))
            {
                $score_5_tr += 2;
            }
        }
        // tr火星3宫+0.5，金星3宫+1，水星3宫+0.5，太阳3宫+0.5，月亮3宫+0.5
        if($tr_planet[4]['in_house_id'] == 3)
        {
            $score_5_tr += 0.5;
        }
        if($tr_planet[3]['in_house_id'] == 3)
        {
            $score_5_tr += 1;
        }
        if($tr_planet[2]['in_house_id'] == 3)
        {
            $score_5_tr += 0.5;
        }
        if($tr_planet[0]['in_house_id'] == 3)
        {
            $score_5_tr += 0.5;
        }
        if($tr_planet[1]['in_house_id'] == 3)
        {
            $score_5_tr += 0.5;
        }
        // tr月亮3宫且与火星或木星或天王成相+3
        if($tr_planet[1]['in_house_id'] == 3 && (isset($tr_planet[1]['phase']['1-4']) || isset($tr_planet[1]['phase']['1-5']) || isset($tr_planet[1]['phase']['1-7'])))
        {
            $score_5_tr += 3;
        }
        // tp月亮3宫+1，此时与火、天、木、金、水之一成相+0.5
        if($tp_planet[1]['in_house_id'] == 3)
        {
            $score_5_tr += 1;
            if(isset($tp_planet[1]['phase']['1-4']) || isset($tp_planet[1]['phase']['1-7']) || isset($tp_planet[1]['phase']['1-5']) || isset($tp_planet[1]['phase']['1-3']) || isset($tp_planet[1]['phase']['1-2']))
            {
                $score_5_tr += 0.5;
            }
        }

        #读书学习
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #看电影
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #聊八卦
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #探亲访友
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;
        #外出
        $score_5 = $score_5_tr + $score_5_tp + $score_5_tx;
        if($score_5_tr && $score_5_tp) $score_5 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '读书学习',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '看电影',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '聊八卦',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '探亲访友',
            'per' => $score_4,
        ];
        if($score_5 > 0) $this->keywords[] = [
            'text' => '外出',
            'per' => $score_5,
        ];
    }
    protected function getKeywordsByHouse4()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planets = $this->natalData['planets'];

        #死宅在家
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tr月亮在4宫无火木金水天相位+3 20181011 改为+2
        if($tr_planet[1]['in_house_id'] == 4 && (
            !isset($tr_planet[1]['phase']['1-2']) && !isset($tr_planet[1]['phase']['1-3']) && !isset($tr_planet[1]['phase']['1-4']) && !isset($tr_planet[1]['phase']['1-5']) && !isset($tr_planet[1]['phase']['1-7'])
            ))
        {
            $score_1_tr += 2;
        }
        // tr日、金、水、火每有一个在4宫+0.5
        if($tr_planet[0]['in_house_id'] == 4)
        {
            $score_1_tr += 0.5;
        }
        if($tr_planet[2]['in_house_id'] == 4)
        {
            $score_1_tr += 0.5;
        }
        if($tr_planet[3]['in_house_id'] == 4)
        {
            $score_1_tr += 0.5;
        }
        if($tr_planet[4]['in_house_id'] == 4)
        {
            $score_1_tr += 0.5;
        }
        // 原局月亮在4宫+0.5，太阳在4宫+0.5
        if($na_planets[1]['in_house_id'] == 4)
        {
            $score_1_tx += 0.5;
        }
        if($na_planets[0]['in_house_id'] == 4)
        {
            $score_1_tx += 0.5;
        }
        // tp月亮4宫+0.5，此时与土星或海冥成相且无火木金水天相位+0.5
        if($tp_planet[1]['in_house_id'] == 4)
        {
            $score_1_tp += 0.5;
            if(
                (isset($tp_planet[1]['phase']['1-6']) || isset($tp_planet[1]['phase']['1-8']) || isset($tp_planet[1]['phase']['1-9']))
                && (!isset($tp_planet[1]['phase']['1-2']) && !isset($tp_planet[1]['phase']['1-3'])
                    && !isset($tp_planet[1]['phase']['1-4']) && !isset($tp_planet[1]['phase']['1-5']) && !isset($tp_planet[1]['phase']['1-7']) )
            )
            {
                $score_1_tp += 0.5;
            }
        }
        // 当前日期不是周六日-10，是周六日+0.5
        if(in_array(date('w',$this->time),[0,6]))
        {
            $score_1_tp += 0.5;
        }
        else
        {
            $score_1_tx -= 10;
        }


        #理清感情
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tr月亮4宫+1，此时每有一个相位+0.5
        if($tr_planet[1]['in_house_id'] == 4)
        {
            $score_2_tr += (1 + count($tr_planet[1]['phase']) * 0.5);

        }
        // tr水星4宫+1，此时成相月亮+0.5
        if($tr_planet[2]['in_house_id'] == 4)
        {
            $score_2_tr += 1;
            if(isset($tr_planet[2]['phase']['2-1']))
            {
                $score_2_tr += 0.5;
            }
        }
        // tr太阳或金星4宫+0.5，此时成相月亮或水星+0.8 ????
        if($tr_planet[0]['in_house_id'] == 4 || $tr_planet[3]['in_house_id'] == 4)
        {
            $score_2_tr += 0.5;
            if(($tr_planet[0]['in_house_id'] == 4 && (isset($tr_planet[0]['phase']['0-1']) || isset($tr_planet[0]['phase']['0-2'])))
                || ($tr_planet[3]['in_house_id'] == 4 && (isset($tr_planet[3]['phase']['3-1']) || isset($tr_planet[3]['phase']['3-2']))))
            {
                $score_2_tr += 0.8;
            }
        }
        // tp月亮4宫+0.5，与金星刑冲+0.3，与海王成相+0.4，与土星成相+0.3
        if($tp_planet[1]['in_house_id'] == 4)
        {
            $score_2_tp += 0.5;
            if(isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[90,180]))
            {
                $score_2_tp += 0.3;
            }
            if(isset($tp_planet[1]['phase']['1-8']) && in_array($tp_planet[1]['phase']['1-8']['phase_e'],[90,180]))
            {
                $score_2_tp += 0.4;
            }
            if(isset($tp_planet[1]['phase']['1-6']) && in_array($tp_planet[1]['phase']['1-6']['phase_e'],[90,180]))
            {
                $score_2_tp += 0.3;
            }
        }

        #回忆往事
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tr月亮4宫+1，与海王成相+2，与土星成相+2，与月亮成相+2
        if($tr_planet[1]['in_house_id'] == 4)
        {
            $score_3_tr += 1;
            if(isset($tr_planet[1]['phase']['1-8']))
            {
                $score_3_tr += 2;
            }
            if(isset($tr_planet[1]['phase']['1-6']))
            {
                $score_3_tr += 2;
            }
            if(isset($tr_planet[1]['phase']['1-1']))
            {
                $score_3_tr += 2;
            }
        }

        #探望家人（与死宅在家谁高显示谁）
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tp月亮4宫与日金水木成非刑相+0.6
        if($tp_planet[1]['in_house_id'] == 4)
        {
            if(
            (isset($tp_planet[1]['phase']['1-0']) && $tp_planet[1]['phase']['1-0']['phase_e'] != 90)
            || (isset($tp_planet[1]['phase']['1-2']) && $tp_planet[1]['phase']['1-2']['phase_e'] != 90)
            || (isset($tp_planet[1]['phase']['1-3']) && $tp_planet[1]['phase']['1-3']['phase_e'] != 90)
            || (isset($tp_planet[1]['phase']['1-5']) && $tp_planet[1]['phase']['1-5']['phase_e'] != 90)
            )
            {
                $score_4_tp += 0.6;
            }
        }
        // tr月亮4宫与本命日月金水木成非刑相+1.5
        if($tr_planet[1]['in_house_id'] == 4
            &&
            (
            (isset($tr_planet[1]['phase']['1-0']) && $tr_planet[1]['phase']['1-0']['phase_e'] != 90)
            || (isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] != 90)
            || (isset($tr_planet[1]['phase']['1-2']) && $tr_planet[1]['phase']['1-2']['phase_e'] != 90)
            || (isset($tr_planet[1]['phase']['1-3']) && $tr_planet[1]['phase']['1-3']['phase_e'] != 90)
            || (isset($tr_planet[1]['phase']['1-5']) && $tr_planet[1]['phase']['1-5']['phase_e'] != 90)
            )
        )
        {
            $score_4_tr += 1.5;
        }
        // tr日金水与本命日月金水木成合拱六分相+2
        if(
            (
                (isset($tr_planet[0]['phase']['0-0']) && in_array($tr_planet[0]['phase']['0-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-1']) && in_array($tr_planet[0]['phase']['0-1']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-2']) && in_array($tr_planet[0]['phase']['0-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-3']) && in_array($tr_planet[0]['phase']['0-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-5']) && in_array($tr_planet[0]['phase']['0-5']['phase_e'],[0,60,120]))
            )
            ||
            (
                (isset($tr_planet[2]['phase']['2-0']) && in_array($tr_planet[2]['phase']['2-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-1']) && in_array($tr_planet[2]['phase']['2-1']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-2']) && in_array($tr_planet[2]['phase']['2-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-3']) && in_array($tr_planet[2]['phase']['2-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-5']) && in_array($tr_planet[2]['phase']['2-5']['phase_e'],[0,60,120]))
            )
            ||
            (
                (isset($tr_planet[3]['phase']['3-0']) && in_array($tr_planet[3]['phase']['3-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-1']) && in_array($tr_planet[3]['phase']['3-1']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-2']) && in_array($tr_planet[3]['phase']['3-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-3']) && in_array($tr_planet[3]['phase']['3-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-5']) && in_array($tr_planet[3]['phase']['3-5']['phase_e'],[0,60,120]))
            )
        )
        {
            $score_4_tr += 2;
        }


        #死宅在家
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #理清感情
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #回忆往事
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #探望家人（与死宅在家谁高显示谁）
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;

        if($score_1 > 0) {
            $is_waichu = false;
            if(!empty($this->keywords))
            {
                foreach ($this->keywords as $kw)
                {
                    if($kw['text'] == '外出')
                    {
                        $is_waichu = true;
                    }
                }
            }
            if($is_waichu === false)
            {
                $this->keywords[] = [
                    'text' => $score_1 > $score_4 ? '一直宅在家' : '探望家人',
                    'per' => $score_1 > $score_4 ? $score_1 : $score_4,
                ];
            }
        }
        
        if($score_2 > 0) $this->keywords[] = [
            'text' => '理清感情',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '回忆往事',
            'per' => $score_3,
        ];
    }
    protected function getKeywordsByHouse5()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据

        #谈情说爱
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp月亮与金星成非刑相+0.5，此时月亮过5/7宫+0.8，此时金火成相+0.3，金木成相+0.3
        if(isset($tp_planet[1]['phase']['1-3']) && $tp_planet[1]['phase']['1-3']['phase_e'] != 90)
        {
            $score_1_tp += 0.5;
            if($tp_planet[1]['in_house_id'] == 5 || $tp_planet[1]['in_house_id'] == 7)
            {
                $score_1_tp += 0.8;
            }
            if(isset($tp_planet[3]['phase']['3-4']))
            {
                $score_1_tp += 0.3;
            }
            if(isset($tp_planet[3]['phase']['3-5']))
            {
                $score_1_tp += 0.3;
            }
        }
        // tp金星5、7宫与火星成相+0.2，与木星成相+0.2，与海王成相+0.2
        if($tp_planet[3]['in_house_id'] == 5 || $tp_planet[3]['in_house_id'] == 7)
        {
            if(isset($tp_planet[3]['phase']['3-4']))
            {
                $score_1_tp += 0.2;
            }
            if(isset($tp_planet[3]['phase']['3-5']))
            {
                $score_1_tp += 0.2;
            }
            if(isset($tp_planet[3]['phase']['3-8']))
            {
                $score_1_tp += 0.2;
            }
        }
        // tr月亮5/7宫，且金星激活+1.5（活跃+2），若tr月非刑相金星再+1
        if($tr_planet[1]['in_house_id'] == 5 || $tr_planet[1]['in_house_id'] == 7)
        {
            if($this->isActive(3) > 0)
            {
                if($this->isActive(3) == 1)
                {
                    $score_1_tr += 1.5;
                }
                elseif($this->isActive(3) > 1)
                {
                    $score_1_tr += 2;
                }
                if(isset($tp_planet[1]['phase']['1-3']) && $tp_planet[1]['phase']['1-3']['phase_e'] != 90)
                {
                    $score_1_tr += 1;
                }
            }
        }
        // tr金成相本命金或火+1，若此时tr金在 1/5/7宫+1
        if(isset($tr_planet[3]['phase']['3-3']) || isset($tr_planet[3]['phase']['3-4']))
        {
            $score_1_tr += 1;
        }
        // tr日或水过5、7宫成相本命金+1
        if(
            (($tr_planet[0]['in_house_id'] == 5 || $tr_planet[0]['in_house_id'] == 7) && isset($tr_planet[0]['phase']['0-3']))
        || (($tr_planet[2]['in_house_id'] == 5 || $tr_planet[2]['in_house_id'] == 7) && isset($tr_planet[2]['phase']['2-3']))
        )
        {
            $score_1_tr += 1;
        }
        // tr金过上升或下降+1
        if((isset($tr_planet[3]['phase']['3-'.ASC]) && $tr_planet[3]['phase']['3-'.ASC]['phase_e'] == 0)
            || (isset($tr_planet[3]['phase']['3-'.DES]) && $tr_planet[3]['phase']['3-'.DES]['phase_e'] == 0))
        {
            $score_1_tr += 1;
        }
        // tr金过中天或天底+0.6
        if((isset($tr_planet[3]['phase']['3-'.IC]) && $tr_planet[3]['phase']['3-'.IC]['phase_e'] == 0)
            || (isset($tr_planet[3]['phase']['3-'.MC]) && $tr_planet[3]['phase']['3-'.MC]['phase_e'] == 0))
        {
            $score_1_tr += 0.6;
        }

        #放松玩耍
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tp月亮在5宫+0.4，若与木星成相+0.4
        if($tp_planet[1]['in_house_id'] == 5)
        {
            $score_2_tp += 0.4;
        }
        // tr月亮在5宫+2，此时与木星成相+1
        if($tr_planet[1]['in_house_id'] == 5)
        {
            $score_2_tr += 2;
            if(isset($tr_planet[1]['phase']['1-5']))
            {
                $score_2_tr += 1;
            }
        }
        // tr日、水、火、金每有一个入5宫+0.3
        if($tr_planet[0]['in_house_id'] == 5)
        {
            $score_2_tr += 0.3;
        }
        if($tr_planet[2]['in_house_id'] == 5)
        {
            $score_2_tr += 0.3;
        }
        if($tr_planet[3]['in_house_id'] == 5)
        {
            $score_2_tr += 0.3;
        }
        if($tr_planet[4]['in_house_id'] == 5)
        {
            $score_2_tr += 0.3;
        }
        // tr木入5宫+0.3
        if($tr_planet[5]['in_house_id'] == 5)
        {
            $score_2_tr += 0.3;
        }
        // tr木过上升+0.3
        if(isset($tr_planet[5]['phase']['5-'.ASC]) && $tr_planet[5]['phase']['5-'.ASC]['phase_e'] == 0)
        {
            $score_2_tr += 0.3;
        }
        // tr木成相太阳+0.2
        if(isset($tr_planet[5]['phase']['5-0']))
        {
            $score_2_tr += 0.2;
        }
        // tr木成相月亮+0.2
        if(isset($tr_planet[5]['phase']['5-1']))
        {
            $score_2_tr += 0.2;
        }

        #文艺创作
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tp月亮在3/5宫成相海王+0.5，此时金星或水星与海王成相+0.4
        if(isset($tp_planet[1]['phase']['1-8']) && in_array($tp_planet[1]['in_house_id'],[3,5]))
        {
            $score_3_tp += 0.5;
            if(isset($tp_planet[2]['phase']['2-8']) || isset($tp_planet[3]['phase']['3-8']))
            {
                $score_3_tp += 0.4;
            }
        }
        // tr月亮在3/5宫成相海王+2，此时金星或水星与海王成相+1
        if(isset($tr_planet[1]['phase']['1-8']) && in_array($tr_planet[1]['in_house_id'],[3,5]))
        {
            $score_3_tr += 2;
            if(isset($tr_planet[2]['phase']['2-8']) || isset($tr_planet[3]['phase']['3-8']))
            {
                $score_3_tr += 1;
            }
        }

        #表白
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tp金火成相+0.4，若金火之一位于5/7宫+0.4
        if(isset($tp_planet[3]['phase']['3-4']))
        {
            $score_4_tp += 0.4;
            if(in_array($tp_planet[3]['in_house_id'],[5,7]) || in_array($tp_planet[4]['in_house_id'],[5,7]))
            {
                $score_4_tp += 0.4;
            }
        }
        // tp金木成相+0.4，若金木之一位于5/7宫+0.4
        if(isset($tp_planet[3]['phase']['3-5']))
        {
            $score_4_tp += 0.4;
            if(in_array($tp_planet[3]['in_house_id'],[5,7]) || in_array($tp_planet[5]['in_house_id'],[5,7]))
            {
                $score_4_tp += 0.4;
            }
        }
        // tp月亮与金水同时成相+0.8
        if(isset($tp_planet[1]['phase']['1-3']) && isset($tp_planet[1]['phase']['1-2']))
        {
            $score_4_tp += 0.8;
        }
        // tp月亮在5/7宫且不与土星成相+0.4，此时若与木或火星成相+0.4
        if(in_array($tp_planet[1]['in_house_id'],[5,7]) && !isset($tp_planet[1]['phase']['1-6']))
        {
            $score_4_tp += 0.4;
            if(isset($tp_planet[1]['phase']['1-4']) || isset($tp_planet[1]['phase']['1-5']))
            {
                $score_4_tp += 0.4;
            }
        }
        // tr月亮在3/5/7宫，且金水同时激活+2【若金水同时活跃则+4】
        if(in_array($tr_planet[1]['in_house_id'],[3,5,7]))
        {
            if($this->isActive(2) == 1 && $this->isActive(3) == 1)
            {
                $score_4_tr += 2;
            }
            elseif($this->isActive(2) > 1 && $this->isActive(3) > 1)
            {
                $score_4_tr += 4;
            }
        }

        #才艺表演
        $score_5_tr = $score_5_tp = $score_5_tx = 0;
        // tr日金在5宫+0.5
        if($tr_planet[0]['in_house_id'] == 5 || $tr_planet[3]['in_house_id'] == 5)
        {
            $score_5_tr += 0.5;
        }

        #谈情说爱
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #放松玩耍
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #文艺创作
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #表白
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;
        #才艺表演
        $score_5 = $score_5_tr + $score_5_tp + $score_5_tx;
        if($score_5_tr && $score_5_tp) $score_5 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '谈情说爱',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '放松玩耍',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '文艺创作',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '表白',
            'per' => $score_4,
        ];
        if($score_5 > 0) $this->keywords[] = [
            'text' => '才艺表演',
            'per' => $score_5,
        ];
    }
    protected function getKeywordsByHouse6()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planets = $this->natalData['planets'];

        #检查身体
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp月6宫与冥王成相+0.6
        if($tp_planet[1]['in_house_id'] == 6 && isset($tp_planet[1]['phase']['1-9']))
        {
            $score_1_tp += 0.6;
        }
        // tr月6宫与冥王成相+2
        if($tr_planet[1]['in_house_id'] == 6 && isset($tr_planet[1]['phase']['1-9']))
        {
            $score_1_tr += 2;
        }
        // tp6宫宫内日水金受火土之一刑冲，且受天海冥之一刑冲+0.5，若此时月亮在6或8宫且与火土天海冥之一合刑冲+0.5
        if(
            ($tp_planet[0]['in_house_id'] == 6
                &&
                (
                    (isset($tp_planet[0]['phase']['0-4']) && in_array($tp_planet[0]['phase']['0-4']['phase_e'],[90,180]))
                    || isset($tp_planet[0]['phase']['0-6']) && in_array($tp_planet[0]['phase']['0-6']['phase_e'],[90,180])
                )
                &&
                (
                    (isset($tp_planet[0]['phase']['0-7']) && in_array($tp_planet[0]['phase']['0-7']['phase_e'],[90,180]))
                    || isset($tp_planet[0]['phase']['0-8']) && in_array($tp_planet[0]['phase']['0-8']['phase_e'],[90,180])
                    || isset($tp_planet[0]['phase']['0-9']) && in_array($tp_planet[0]['phase']['0-9']['phase_e'],[90,180])
                )
            )
            ||
            ($tp_planet[2]['in_house_id'] == 6
                &&
                (
                    (isset($tp_planet[2]['phase']['2-4']) && in_array($tp_planet[2]['phase']['2-4']['phase_e'],[90,180]))
                    || isset($tp_planet[2]['phase']['2-6']) && in_array($tp_planet[2]['phase']['2-6']['phase_e'],[90,180])
                )
                &&
                (
                    (isset($tp_planet[2]['phase']['2-7']) && in_array($tp_planet[2]['phase']['2-7']['phase_e'],[90,180]))
                    || isset($tp_planet[2]['phase']['2-8']) && in_array($tp_planet[2]['phase']['2-8']['phase_e'],[90,180])
                    || isset($tp_planet[2]['phase']['2-9']) && in_array($tp_planet[2]['phase']['2-9']['phase_e'],[90,180])
                )
            )
            ||
            ($tp_planet[3]['in_house_id'] == 6
                &&
                (
                    (isset($tp_planet[3]['phase']['3-4']) && in_array($tp_planet[3]['phase']['3-4']['phase_e'],[90,180]))
                    || isset($tp_planet[3]['phase']['3-6']) && in_array($tp_planet[3]['phase']['3-6']['phase_e'],[90,180])
                )
                &&
                (
                    (isset($tp_planet[3]['phase']['3-7']) && in_array($tp_planet[3]['phase']['3-7']['phase_e'],[90,180]))
                    || isset($tp_planet[3]['phase']['3-8']) && in_array($tp_planet[3]['phase']['3-8']['phase_e'],[90,180])
                    || isset($tp_planet[3]['phase']['3-9']) && in_array($tp_planet[3]['phase']['3-9']['phase_e'],[90,180])
                )
            )
        )
        {
            $score_1_tp += 0.5;
            if(
                in_array($tp_planet[1]['in_house_id'],[6,8])
                &&
                (
                    (isset($tp_planet[1]['phase']['1-4']) && in_array($tp_planet[1]['phase']['1-4']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-6']) && in_array($tp_planet[1]['phase']['1-6']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-7']) && in_array($tp_planet[1]['phase']['1-7']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-8']) && in_array($tp_planet[1]['phase']['1-8']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-9']) && in_array($tp_planet[1]['phase']['1-9']['phase_e'],[0,90,180]))
                )
            )
            {
                $score_1_tp += 0.5;
            }
        }
        // tp8宫宫内日水金受火土之一刑冲，且受天海冥之一刑冲+0.5，若此时月亮在8宫或6宫且与火土天海冥之一合刑冲+0.5
        if(
            ($tp_planet[0]['in_house_id'] == 8
                &&
                (
                    (isset($tp_planet[0]['phase']['0-4']) && in_array($tp_planet[0]['phase']['0-4']['phase_e'],[90,180]))
                    || isset($tp_planet[0]['phase']['0-6']) && in_array($tp_planet[0]['phase']['0-6']['phase_e'],[90,180])
                )
                &&
                (
                    (isset($tp_planet[0]['phase']['0-7']) && in_array($tp_planet[0]['phase']['0-7']['phase_e'],[90,180]))
                    || isset($tp_planet[0]['phase']['0-8']) && in_array($tp_planet[0]['phase']['0-8']['phase_e'],[90,180])
                    || isset($tp_planet[0]['phase']['0-9']) && in_array($tp_planet[0]['phase']['0-9']['phase_e'],[90,180])
                )
            )
            ||
            ($tp_planet[2]['in_house_id'] == 8
                &&
                (
                    (isset($tp_planet[2]['phase']['2-4']) && in_array($tp_planet[2]['phase']['2-4']['phase_e'],[90,180]))
                    || isset($tp_planet[2]['phase']['2-6']) && in_array($tp_planet[2]['phase']['2-6']['phase_e'],[90,180])
                )
                &&
                (
                    (isset($tp_planet[2]['phase']['2-7']) && in_array($tp_planet[2]['phase']['2-7']['phase_e'],[90,180]))
                    || isset($tp_planet[2]['phase']['2-8']) && in_array($tp_planet[2]['phase']['2-8']['phase_e'],[90,180])
                    || isset($tp_planet[2]['phase']['2-9']) && in_array($tp_planet[2]['phase']['2-9']['phase_e'],[90,180])
                )
            )
            ||
            ($tp_planet[3]['in_house_id'] == 8
                &&
                (
                    (isset($tp_planet[3]['phase']['3-4']) && in_array($tp_planet[3]['phase']['3-4']['phase_e'],[90,180]))
                    || isset($tp_planet[3]['phase']['3-6']) && in_array($tp_planet[3]['phase']['3-6']['phase_e'],[90,180])
                )
                &&
                (
                    (isset($tp_planet[3]['phase']['3-7']) && in_array($tp_planet[3]['phase']['3-7']['phase_e'],[90,180]))
                    || isset($tp_planet[3]['phase']['3-8']) && in_array($tp_planet[3]['phase']['3-8']['phase_e'],[90,180])
                    || isset($tp_planet[3]['phase']['3-9']) && in_array($tp_planet[3]['phase']['3-9']['phase_e'],[90,180])
                )
            )
        )
        {
            $score_1_tp += 0.5;
            if(
                in_array($tp_planet[1]['in_house_id'],[6,8])
                &&
                (
                    (isset($tp_planet[1]['phase']['1-4']) && in_array($tp_planet[1]['phase']['1-4']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-6']) && in_array($tp_planet[1]['phase']['1-6']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-7']) && in_array($tp_planet[1]['phase']['1-7']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-8']) && in_array($tp_planet[1]['phase']['1-8']['phase_e'],[0,90,180]))
                    || (isset($tp_planet[1]['phase']['1-9']) && in_array($tp_planet[1]['phase']['1-9']['phase_e'],[0,90,180]))
                )
            )
            {
                $score_1_tp += 0.5;
            }
        }
        // 本命日月在6/8宫被流年土天海冥刑冲合+0.4【每有一组】，此时若tr日金水火之一合相该日或月+1.5【每有一组】,此时tr月亮合该日或月+3  ????
        if(in_array($na_planets[0]['in_house_id'],[6,8]))
        {
            if(isset($tr_planet[6]['phase']['6-0']) && in_array($tr_planet[6]['phase']['6-0']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-0']) && $tr_planet[0]['phase']['0-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-0']) && $tr_planet[2]['phase']['2-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-0']) && $tr_planet[3]['phase']['3-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-0']) && $tr_planet[4]['phase']['4-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-0']) && $tr_planet[1]['phase']['1-0']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
            if(isset($tr_planet[7]['phase']['7-0']) && in_array($tr_planet[7]['phase']['7-0']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-0']) && $tr_planet[0]['phase']['0-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-0']) && $tr_planet[2]['phase']['2-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-0']) && $tr_planet[3]['phase']['3-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-0']) && $tr_planet[4]['phase']['4-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-0']) && $tr_planet[1]['phase']['1-0']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
            if(isset($tr_planet[8]['phase']['8-0']) && in_array($tr_planet[8]['phase']['8-0']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-0']) && $tr_planet[0]['phase']['0-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-0']) && $tr_planet[2]['phase']['2-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-0']) && $tr_planet[3]['phase']['3-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-0']) && $tr_planet[4]['phase']['4-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-0']) && $tr_planet[1]['phase']['1-0']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
            if(isset($tr_planet[9]['phase']['9-0']) && in_array($tr_planet[9]['phase']['9-0']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-0']) && $tr_planet[0]['phase']['0-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-0']) && $tr_planet[2]['phase']['2-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-0']) && $tr_planet[3]['phase']['3-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-0']) && $tr_planet[4]['phase']['4-0']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-0']) && $tr_planet[1]['phase']['1-0']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
        }
        if(in_array($na_planets[1]['in_house_id'],[6,8]))
        {
            if(isset($tr_planet[6]['phase']['6-1']) && in_array($tr_planet[6]['phase']['6-1']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-1']) && $tr_planet[0]['phase']['0-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-1']) && $tr_planet[2]['phase']['2-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-1']) && $tr_planet[3]['phase']['3-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-1']) && $tr_planet[4]['phase']['4-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
            if(isset($tr_planet[7]['phase']['7-1']) && in_array($tr_planet[7]['phase']['7-1']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-1']) && $tr_planet[0]['phase']['0-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-1']) && $tr_planet[2]['phase']['2-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-1']) && $tr_planet[3]['phase']['3-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-1']) && $tr_planet[4]['phase']['4-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
            if(isset($tr_planet[8]['phase']['8-1']) && in_array($tr_planet[8]['phase']['8-1']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-1']) && $tr_planet[0]['phase']['0-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-1']) && $tr_planet[2]['phase']['2-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-1']) && $tr_planet[3]['phase']['3-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-1']) && $tr_planet[4]['phase']['4-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
            if(isset($tr_planet[9]['phase']['9-1']) && in_array($tr_planet[9]['phase']['9-1']['phase_e'],[0,90,180]))
            {
                $score_1_tr += 0.4;
                if(isset($tr_planet[0]['phase']['0-1']) && $tr_planet[0]['phase']['0-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[2]['phase']['2-1']) && $tr_planet[2]['phase']['2-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[3]['phase']['3-1']) && $tr_planet[3]['phase']['3-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[4]['phase']['4-1']) && $tr_planet[4]['phase']['4-1']['phase_e'] == 0)
                {
                    $score_1_tr += 1.5;
                }
                if(isset($tr_planet[1]['phase']['1-1']) && $tr_planet[1]['phase']['1-1']['phase_e'] == 0)
                {
                    $score_1_tr += 3;
                }
            }
        }


        #领养宠物
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tp月6宫与金星成相+0.6
        if($tp_planet[1]['in_house_id'] == 6 && isset($tp_planet[1]['phase']['1-3']))
        {
            $score_2_tp += 0.6;
        }
        // tr月6宫与金星成相+2
        if($tr_planet[1]['in_house_id'] == 6 && isset($tr_planet[1]['phase']['1-3']))
        {
            $score_2_tr += 2;
        }
        // tp金6宫与月亮成冲拱六分+0.4
        if($tp_planet[3]['in_house_id'] == 6 && isset($tp_planet[3]['phase']['3-1'])
            && in_array($tp_planet[3]['phase']['3-1']['phase_e'],[60,120,180]))
        {
            $score_2_tp += 0.4;
        }

        #刻苦工作
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tp月亮6或10宫 与火星成相+0.8，若为合相+0.2，若此时月土成相+0.5  ????
        if(in_array($tp_planet[1]['in_house_id'],[6,10]) && isset($tp_planet[1]['phase']['1-4']))
        {
            $score_3_tp += 0.8;
            if($tp_planet[1]['phase']['1-4']['phase_e'] == 0)
            {
                $score_3_tp += 0.2;
            }
            if(isset($tp_planet[1]['phase']['1-6']))
            {
                $score_3_tp += 0.5;
            }
        }
        // tr月亮6或10宫 与火星成相+2，若为合相+1，若此时月土成相+1
        if(in_array($tr_planet[1]['in_house_id'],[6,10]) && isset($tr_planet[1]['phase']['1-4']))
        {
            $score_3_tr += 2;
            if($tr_planet[1]['phase']['1-4']['phase_e'] == 0)
            {
                $score_3_tr += 1;
            }
            if(isset($tr_planet[1]['phase']['1-6']))
            {
                $score_3_tr += 1;
            }
        }
        // tr火星6宫+0.4，若此时成相本命月亮或太阳+1
        if($tr_planet[4]['in_house_id'] == 6)
        {
            $score_3_tr += 0.4;
            if(isset($tr_planet[4]['phase']['1-0']) || isset($tr_planet[4]['phase']['1-1']))
            {
                $score_3_tr += 1;
            }
        }
        // tr水日6宫+0.2，若此时成相本命火星+0.8  20181011 改为 +1.5
        if($tr_planet[2]['in_house_id'] == 6 && $tr_planet[0]['in_house_id'] == 6)
        {
            $score_3_tr += 0.2;
            if(isset($tr_planet[2]['phase']['2-4']))
            {
                $score_3_tr += 1.5;
            }
            if(isset($tr_planet[0]['phase']['0-4']))
            {
                $score_3_tr += 1.5;
            }
        }
        // 本命日火成相+0.1，此时日土成相+0.1
        if(isset($na_planets[0]['phase']['0-4']))
        {
            $score_3_tx += 0.1;
            if(isset($na_planets[0]['phase']['0-6']))
            {
                $score_3_tx += 0.1;
            }
        }

        #调整工作
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tp月亮与天王成相+0.8，此时月亮在6/11或天王在6/11+0.5
        if(isset($tp_planet[1]['phase']['1-7']))
        {
            $score_4_tp += 0.8;
            if(in_array($tp_planet[1]['in_house_id'],[6,11]) || in_array($tp_planet[7]['in_house_id'],[6,11]))
            {
                $score_4_tp += 0.5;
            }
        }
        // tr月亮过6宫（或10）与天王成相+1
        if(in_array($tr_planet[1]['in_house_id'],[6,10]) && isset($tr_planet[1]['phase']['1-7']))
        {
            $score_4_tr += 1;
        }
        // tr水星或太阳过6或10宫与天王成相+0.5
        if(
            (in_array($tr_planet[0]['in_house_id'],[6,10]) && isset($tr_planet[0]['phase']['0-7']))
            || (in_array($tr_planet[2]['in_house_id'],[6,10]) && isset($tr_planet[2]['phase']['2-7']))
        )
        {
            $score_4_tr += 0.5;
        }
        // tr天王刑冲太阳（1度）+0.3
        if(isset($tr_planet[7]['phase']['7-0'])
            && in_array($tr_planet[7]['phase']['7-0']['phase_e'],[90,180]) && $tr_planet[7]['phase']['7-0']['phase_orb'] <= 1)
        {
            $score_4_tr += 0.3;
        }
        // tp天王刑冲太阳（1度）+0.4
        if(isset($tp_planet[7]['phase']['7-0'])
            && in_array($tp_planet[7]['phase']['7-0']['phase_e'],[90,180]) && $tp_planet[7]['phase']['7-0']['phase_orb'] <= 1)
        {
            $score_4_tp += 0.4;
        }
        // tp月亮刑冲水星且水星6宫+0.4  ????
        if(isset($tp_planet[1]['phase']['1-2'])
            && in_array($tp_planet[1]['phase']['1-2']['phase_e'],[90,180]) && $na_planets[6]['in_house_id'] == 6)
        {
            $score_4_tp += 0.4;
        }

        #检查身体
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #领养宠物
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #刻苦工作
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #调整工作
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '检查身体',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '领养宠物',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '刻苦工作',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '调整工作',
            'per' => $score_4,
        ];
    }
    protected function getKeywordsByHouse7()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据

        #结交朋友
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp月7宫与木星成相+0.9
        if($tp_planet[1]['in_house_id'] == 7 && isset($tp_planet[1]['phase']['1-5']))
        {
            $score_1_tp += 0.9;
        }
        // tp月7宫与金星成非刑相+0.7
        if($tp_planet[1]['in_house_id'] == 7 && isset($tp_planet[1]['phase']['1-3']) && $tp_planet[1]['phase']['1-3']['phase_e'] != 90)
        {
            $score_1_tp += 0.7;
        }
        // tr月7宫与金星成非刑相+2
        if($tr_planet[1]['in_house_id'] == 7 && isset($tr_planet[1]['phase']['1-3']) && $tr_planet[1]['phase']['1-3']['phase_e'] != 90)
        {
            $score_1_tr += 2;
        }
        // tr月7宫与木星成相+2
        if($tr_planet[1]['in_house_id'] == 7 && isset($tr_planet[1]['phase']['1-5']))
        {
            $score_1_tr += 2;
        }
        // tr金合上升或下降+0.8
        if(isset($tr_planet[3]['phase']['3-'.ASC]) && in_array($tr_planet[3]['phase']['3-'.ASC]['phase_e'],[0,180]))
        {
            $score_1_tr += 0.8;
        }
        // tr金落1/7宫成相且与水或木成合拱六分+0.8
        if(in_array($tr_planet[3]['in_house_id'],[1,7])
            && (
                (isset($tr_planet[3]['phase_e']['3-2']) && in_array($tr_planet[3]['phase_e']['3-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase_e']['3-5']) && in_array($tr_planet[3]['phase_e']['3-5']['phase_e'],[0,60,120]))
            ))
        {
            $score_1_tr += 0.8;
        }


        #求婚
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
//        // tp金星无天海冥土刑冲合相，且月亮1/4/5/7/10宫与金星非刑相+0.6，若此时金木成相或金火非刑冲相或木星合四轴+0.5，若此时月水非刑冲+0.4 ????
//        if(
//            (!isset($tp_planet[3]['phase']['3-6']) || !in_array($tp_planet[3]['phase']['3-6']['phase_e'],[0,90,180]))
//            && (!isset($tp_planet[3]['phase']['3-7']) || !in_array($tp_planet[3]['phase']['3-7']['phase_e'],[0,90,180]))
//            && (!isset($tp_planet[3]['phase']['3-8']) || !in_array($tp_planet[3]['phase']['3-8']['phase_e'],[0,90,180]))
//            && (!isset($tp_planet[3]['phase']['3-9']) || !in_array($tp_planet[3]['phase']['3-9']['phase_e'],[0,90,180]))
//            && (
//                in_array($tp_planet[1]['in_house_id'],[1,4,5,7,10])
//                && (
//                    !isset($tp_planet[1]['phase']['1-3']) || $tp_planet[1]['phase']['1-3']['phase_e'] != 90
//                )
//            )
//        )
//        {
//            $score_2_tp += 0.6;
//            if(isset($tp_planet[3]['phase']['3-5'])
//                || (isset($tp_planet[3]['phase']['3-4']) && in_array($tp_planet[3]['phase']['3-4']['phase_e'],[90,180]))
//                || (isset($tp_planet[5]['phase']['5-'.ASC]) && in_array($tp_planet[5]['phase']['5-'.ASC]['phase_e'],[90,180]))
//                || (isset($tp_planet[5]['phase']['5-'.MC]) && in_array($tp_planet[5]['phase']['5-'.MC]['phase_e'],[90,180]))
//            )
//            {
//                $score_2_tp += 0.5;
//            }
//        }
//        // 本命金星无tr天海冥土刑冲合相，且tr月亮1/4/5/7/10宫与金星非刑相+2，若此时tr木金成相或木星合四轴+1，若此时tr月水非刑冲+1
//        if(
//            (!isset($tr_planet[6]['phase']['6-3']) || !in_array($tr_planet[6]['phase']['6-3']['phase_e'],[0,90,180]))
//            && (!isset($tr_planet[7]['phase']['7-3']) || !in_array($tr_planet[7]['phase']['7-3']['phase_e'],[0,90,180]))
//            && (!isset($tr_planet[8]['phase']['8-3']) || !in_array($tr_planet[8]['phase']['8-3']['phase_e'],[0,90,180]))
//            && (!isset($tr_planet[9]['phase']['9-3']) || !in_array($tr_planet[9]['phase']['9-3']['phase_e'],[0,90,180]))
//            && in_array($tr_planet[1]['in_house_id'],[1,4,5,7,10])
//            && (!isset($tp_planet[1]['phase']['1-3']) || $tp_planet[1]['phase']['1-3']['phase_e'] != 90)
//        )
//        {
//            $score_2_tr += 2;
//            if(isset($tr_planet[5]['phase']['5-3'])
//                || (isset($tr_planet[5]['phase']['5-'.ASC]) && in_array($tr_planet[5]['phase']['5-'.ASC]['phase_e'],[90,180]))
//                || (isset($tr_planet[5]['phase']['5-'.MC]) && in_array($tr_planet[5]['phase']['5-'.MC]['phase_e'],[90,180])))
//            {
//                $score_2_tr += 1;
//            }
//            if(isset($tr_planet[1]['phase']['1-2']) && !in_array($tr_planet[1]['phase']['1-2']['phase_e'],[90,180]))
//            {
//                $score_2_tr += 1;
//            }
//        }
        // 求婚 20180903
        // tp金星无天海冥土刑冲合相，且月亮1/4/5/7/10宫与金星非刑相+0.6，若此时金木成相或金火非刑冲相或木星合四轴+0.5，若此时月水非刑冲+0.4
        // 本命金星无tr天海冥土刑冲合相，且tr月亮1/4/5/7/10宫与金星非刑相+2，若此时tr木金成相或木星合四轴+1，若此时tr月水非刑冲+1
        if(!checkPhase([3],[7,8,9],[0,90,180],$tp_planet)
            && checkSignHouse([1],[1,4,5,7,10],$tp_planet)
            && checkPhase([1],[3],[0,60,120,180],$tp_planet)
        )
        {
            $score_2_tp += 0.6;
            if(checkPhase([3],[5],[],$tp_planet)
                || checkPhase([3],[4],[0,60,120],$tp_planet)
                || checkPhase([5],[ASC,MC],[0,180],$tp_planet)
            )
            {
                $score_2_tp += 0.5;
            }
            if(checkPhase([1],[2],[0,60,120],$tp_planet))
            {
                $score_2_tp += 0.4;
            }
        }
        if(checkPhase([6,7,8,9],[3],[0,90,180],$tr_planet) && checkSignHouse([1],[1,4,5,7,10],$tr_planet) && checkPhase([1],[3],[0,60,120,180]))
        {
            $score_2_tr += 2;
            if(checkPhase([5],[3],[],$tr_planet) || checkPhase([5],[ASC,MC],[0,180],$tr_planet))
            {
                $score_2_tr += 1;
            }
            if(checkPhase([1],[2],[0,60,120],$tr_planet))
            {
                $score_2_tr += 1;
            }
        }

        #谈合作
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tp月亮7宫与金星非刑冲相+0.5
        if($tp_planet[1]['in_house_id'] == 7 && isset($tp_planet[1]['phase']['1-3']) && !in_array($tp_planet[1]['phase']['1-3']['phase_e'],[90,180]))
        {
            $score_3_tp += 0.5;
        }
        // tp月亮7宫与水星非刑冲相+0.5
        if($tp_planet[1]['in_house_id'] == 7 && isset($tp_planet[1]['phase']['1-2']) && !in_array($tp_planet[1]['phase']['1-2']['phase_e'],[90,180]))
        {
            $score_3_tp += 0.5;
        }
        // tr月亮7宫与水星非刑冲相+2，此时金星活跃+1
        if($tr_planet[1]['in_house_id'] == 7 && isset($tr_planet[1]['phase']['1-2']) && !in_array($tr_planet[1]['phase']['1-2']['phase_e'],[90,180]))
        {
            $score_3_tr += 2;
            if($this->isActive(3) == 1)
            {
                $score_3_tr += 1;
            }
        }
        // tr月亮7宫与金星非刑冲相+2，此时水星活跃+1
        if($tr_planet[1]['in_house_id'] == 7 && isset($tr_planet[1]['phase']['1-3']) && !in_array($tr_planet[1]['phase']['1-3']['phase_e'],[90,180]))
        {
            $score_3_tr += 2;
            if($this->isActive(2) == 1)
            {
                $score_3_tr += 1;
            }
        }

        #主动沟通
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tr月3/7宫成相木星，且无土星火星与流月流水成相+3
        if(in_array($tr_planet[1]['in_house_id'],[3,7]) && isset($tr_planet[1]['phase']['1-5'])
            && !isset($tr_planet[1]['phase']['1-4']) && !isset($tr_planet[1]['phase']['1-6'])
            && !isset($tr_planet[2]['phase']['2-4']) && !isset($tr_planet[2]['phase']['2-6'])
        )
        {
            $score_4_tr += 3;
        }
        // tr水3/7宫成相木星，且无土星火星与流月流水成相+1.5
        if(in_array($tr_planet[2]['in_house_id'],[3,7]) && isset($tr_planet[2]['phase']['2-5'])
            && !isset($tr_planet[1]['phase']['1-4']) && !isset($tr_planet[1]['phase']['1-6'])
            && !isset($tr_planet[2]['phase']['2-4']) && !isset($tr_planet[2]['phase']['2-6'])
        )
        {
            $score_4_tr += 1.5;
        }
        // tr金3/7宫成相月木日水，且无土星火星与流月流水成相+1
        if(in_array($tr_planet[3]['in_house_id'],[3,7]) && (
            isset($tr_planet[3]['phase']['3-0'])
            || isset($tr_planet[3]['phase']['3-1'])
            || isset($tr_planet[3]['phase']['3-2'])
            || isset($tr_planet[3]['phase']['3-5'])
            )
            && !isset($tr_planet[1]['phase']['1-4']) && !isset($tr_planet[1]['phase']['1-6'])
            && !isset($tr_planet[2]['phase']['2-4']) && !isset($tr_planet[2]['phase']['2-6'])
        )
        {
            $score_4_tr += 1;
        }
        // tp月3/7宫成相木星，且无土火刑冲水月+0.8
        if(in_array($tp_planet[1]['in_house_id'],[3,7]) && isset($tp_planet[1]['phase']['1-5'])
            && (!isset($tp_planet[1]['phase']['1-4']) || !in_array($tp_planet[1]['phase']['1-4']['phase_e'],[90,180]))
            && (!isset($tp_planet[1]['phase']['1-6']) || !in_array($tp_planet[1]['phase']['1-6']['phase_e'],[90,180]))
            && (!isset($tp_planet[2]['phase']['2-4']) || !in_array($tp_planet[2]['phase']['2-4']['phase_e'],[90,180]))
            && (!isset($tp_planet[2]['phase']['2-6']) || !in_array($tp_planet[2]['phase']['2-6']['phase_e'],[90,180]))
        )
        {
            $score_4_tp += 0.8;
        }

        #结交朋友
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #求婚
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #谈合作
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #主动沟通
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '结交朋友',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '求婚',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '谈合作',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '主动沟通',
            'per' => $score_4,
        ];
    }
    protected function getKeywordsByHouse8()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planets = $this->natalData['planets'];

        #思考人生
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp月亮在8/12宫与水木天海之一成相+0.7，两颗以上+1
        if(in_array($tp_planet[1]['in_house_id'],[8,12]))
        {
            $phase_num = 0;
            if(isset($tp_planet[1]['phase']['1-2'])) $phase_num++;
            if(isset($tp_planet[1]['phase']['1-5'])) $phase_num++;
            if(isset($tp_planet[1]['phase']['1-7'])) $phase_num++;
            if(isset($tp_planet[1]['phase']['1-8'])) $phase_num++;
            if($phase_num == 0)
            {
                $score_1_tp += 0.7;
            }
            elseif($phase_num >= 2)
            {
                $score_1_tp += 1;
            }
        }
        // tr月亮在8/12宫与水木天海之一成相+2，两颗以上+3
        if(in_array($tr_planet[1]['in_house_id'],[8,12]))
        {
            $phase_num = 0;
            if(isset($tr_planet[1]['phase']['1-2'])) $phase_num++;
            if(isset($tr_planet[1]['phase']['1-5'])) $phase_num++;
            if(isset($tr_planet[1]['phase']['1-7'])) $phase_num++;
            if(isset($tr_planet[1]['phase']['1-8'])) $phase_num++;
            if($phase_num == 0)
            {
                $score_1_tr += 2;
            }
            elseif($phase_num >= 2)
            {
                $score_1_tr += 3;
            }
        }
        // tp水星8、12宫与月亮成相+0.7
        if(in_array($tp_planet[2]['in_house_id'],[8,12]) && isset($tp_planet[2]['phase']['2-1']))
        {
            $score_1_tp += 0.7;
        }

        #学命理
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tp月亮在8/12宫与水或木成相+0.4,若此时tp日海成相或日天成相或水木成相+0.4，此时若本命水星8宫、9宫或水木成相或水星水瓶或水星天蝎或上升处女，每符合一个条件+0.3，此时若tp木星3宫+0.5
        if(in_array($tp_planet[1]['in_house_id'],[8,12]) && (isset($tp_planet[1]['phase']['1-2']) || isset($tp_planet[1]['phase']['1-5'])))
        {
            $score_2_tp += 0.4;
            if(isset($tp_planet[0]['phase']['0-8']) || isset($tp_planet[0]['phase']['0-7']) || isset($tp_planet[2]['phase']['2-5']))
            {
                $score_2_tp += 0.4;
            }
            if($na_planets[2]['in_house_id'] == 8 || $na_planets[2]['in_house_id'] == 9)
            {
                $score_2_tp += 0.3;
            }
            if(isset($na_planets[2]['phase']['2-5']))
            {
                $score_2_tp += 0.3;
            }
            if($na_planets[2]['in_sign_id'] == 11 || $na_planets[2]['in_sign_id'] == 8)
            {
                $score_2_tp += 0.3;
            }
            if($na_planets[ASC]['in_sign_id'] == 6)
            {
                $score_2_tp += 0.3;
            }
            if($tp_planet[5]['in_house_id'] == 3)
            {
                $score_2_tp += 0.5;
            }
        }
        // tr月亮或水星在8/12宫与水或木成相+1.5,若此时tr海日或天日或海月成相+0.4，此时若本命水星8宫、9宫或水木成相或水星水瓶或水星天蝎或上升处女，每符合一个条件+0.3，此时若tr木星3宫+0.5
        if(in_array($tr_planet[2]['in_house_id'],[8,12]) && (isset($tr_planet[1]['phase']['1-2']) || isset($tr_planet[1]['phase']['1-5'])))
        {
            $score_2_tr += 1.5;
            if(isset($tr_planet[8]['phase']['8-0']) || isset($tr_planet[7]['phase']['7-0']) || isset($tr_planet[8]['phase']['8-1']))
            {
                $score_2_tr += 0.4;
            }
            if(in_array($na_planets[2]['in_house_id'],[8,12]))
            {
                $score_2_tr += 0.3;
            }
            if(isset($na_planets[2]['phase']['2-5']))
            {
                $score_2_tr += 0.3;
            }
            if($na_planets[2]['in_sign_id'] == 11 || $na_planets[2]['in_sign_id'] == 8)
            {
                $score_2_tr += 0.3;
            }
            if($na_planets[ASC]['in_sign_id'] == 6)
            {
                $score_2_tr += 0.3;
            }
        }

        #讨债
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tp月亮7宫合拱金星+1，tp月亮8宫或2宫与金星成相+1，tp月亮8宫或2宫与木星成合拱六分相+1
        if($tp_planet[1]['in_house_id'] == 7 && isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[0,120]))
        {
            $score_3_tp += 1;
        }
        if(in_array($tp_planet[1]['in_house_id'],[8,2]) && isset($tp_planet[1]['phase']['1-3']))
        {
            $score_3_tp += 1;
        }
        if(in_array($tp_planet[1]['in_house_id'],[8,2]) && isset($tp_planet[1]['phase']['1-5'])
            && in_array($tp_planet[1]['phase']['1-5']['phase_e'],[0,60,120]))
        {
            $score_3_tp += 1;
        }
        // tr金星激活+0.6，tr金星活跃+1，tr月过2或8宫+0.3
        if($this->isActive(3) == 1)
        {
            $score_3_tr += 0.6;
        }
        elseif($this->isActive(3) > 1)
        {
            $score_3_tr += 1;
        }
        if(in_array($tr_planet[1]['in_house_id'],[2,8]))
        {
            $score_3_tr += 0.3;
        }
        // tr2宫太阳或金星与本命太阳/金星/水星/月亮/木星成合拱六分相+2
        if(
            (
                $tr_planet[0]['in_house_id'] == 2
                &&
                (
                    (isset($tr_planet[0]['phase']['0-0']) && in_array($tr_planet[0]['phase']['0-0']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[0]['phase']['0-1']) && in_array($tr_planet[0]['phase']['0-1']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[0]['phase']['0-2']) && in_array($tr_planet[0]['phase']['0-2']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[0]['phase']['0-3']) && in_array($tr_planet[0]['phase']['0-3']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[0]['phase']['0-5']) && in_array($tr_planet[0]['phase']['0-5']['phase_e'],[0,60,120]))
                )
            )
            ||
            (
                $tr_planet[3]['in_house_id'] == 2
                &&
                (
                    (isset($tr_planet[3]['phase']['3-0']) && in_array($tr_planet[3]['phase']['3-0']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[3]['phase']['3-1']) && in_array($tr_planet[3]['phase']['3-1']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[3]['phase']['3-2']) && in_array($tr_planet[3]['phase']['3-2']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[3]['phase']['3-3']) && in_array($tr_planet[3]['phase']['3-3']['phase_e'],[0,60,120]))
                    || (isset($tr_planet[3]['phase']['3-5']) && in_array($tr_planet[3]['phase']['3-5']['phase_e'],[0,60,120]))
                )
            )
        )
        {
            $score_3_tr += 2;
        }

        #思考人生
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #学命理
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #讨债
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '思考人生',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '学命理',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '讨债',
            'per' => $score_3,
        ];
    }
    protected function getKeywordsByHouse9()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $tx_planet = $this->nowData['planets'];// 天象数据
        $na_planets = $this->natalData['planets'];

        #出远门
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp月亮9宫+0.2，与火星、木星、水星、天王之一成合拱六分相+0.3（叠加），与金星合拱六分+0.2；若此时tp日木或日天成相+0.2，tp木3宫或9宫+0.3
        if($tp_planet[1]['in_house_id'] == 9)
        {
            $score_1_tp += 0.2;
            if(isset($tp_planet[1]['phase']['1-2']) && in_array($tp_planet[1]['phase']['1-2']['phase_e'],[0,60,120]))
            {
                $score_1_tp += 0.3;
            }
            if(isset($tp_planet[1]['phase']['1-4']) && in_array($tp_planet[1]['phase']['1-4']['phase_e'],[0,60,120]))
            {
                $score_1_tp += 0.3;
            }
            if(isset($tp_planet[1]['phase']['1-5']) && in_array($tp_planet[1]['phase']['1-5']['phase_e'],[0,60,120]))
            {
                $score_1_tp += 0.3;
            }
            if(isset($tp_planet[1]['phase']['1-7']) && in_array($tp_planet[1]['phase']['1-7']['phase_e'],[0,60,120]))
            {
                $score_1_tp += 0.3;
            }
            if(isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
            {
                $score_1_tp += 0.2;
            }
            if($score_1_tp >= 0.4)
            {
                if(isset($tp_planet[0]['phase']['0-5']) || isset($tp_planet[0]['phase']['0-7']))
                {
                    $score_1_tp += 0.2;
                }
                if($tp_planet[5]['in_house_id'] == 3 || $tp_planet[5]['in_house_id'] == 9)
                {
                    $score_1_tp += 0.3;
                }
            }
        }
        // tr日金水火木之一落9宫+0.2（叠加），天海冥之一落9宫+0.1
        if($tr_planet[0]['in_house_id'] == 9)
        {
            $score_1_tr += 0.2;
        }
        if($tr_planet[2]['in_house_id'] == 9)
        {
            $score_1_tr += 0.2;
        }
        if($tr_planet[3]['in_house_id'] == 9)
        {
            $score_1_tr += 0.2;
        }
        if($tr_planet[4]['in_house_id'] == 9)
        {
            $score_1_tr += 0.2;
        }
        if($tr_planet[5]['in_house_id'] == 9)
        {
            $score_1_tr += 0.2;
        }
        if($tr_planet[7]['in_house_id'] == 9 || $tr_planet[8]['in_house_id'] == 9 || $tr_planet[9]['in_house_id'] == 9)
        {
            $score_1_tr += 0.1;
        }
        // 本命日或月9宫，与tr天王刑冲合+0.3，若此时与tr日月水火合刑冲+1.5
        if(($na_planets[0]['in_house_id'] == 9 && isset($tr_planet[7]['phase']['7-0']) && in_array($tr_planet[7]['phase']['7-0'],[0,90,180]))
            || ($na_planets[1]['in_house_id'] == 9 && isset($tr_planet[7]['phase']['7-1']) && in_array($tr_planet[7]['phase']['7-1'],[0,90,180])))
        {
            $score_1_tr += 0.3;
            if(($na_planets[0]['in_house_id'] == 9
                && ((isset($tr_planet[0]['phase']['0-0']) && in_array($tr_planet[0]['phase']['0-0'],[0,90,180]))
                    || (isset($tr_planet[1]['phase']['1-0']) && in_array($tr_planet[1]['phase']['1-0'],[0,90,180]))
                    || (isset($tr_planet[2]['phase']['2-0']) && in_array($tr_planet[2]['phase']['2-0'],[0,90,180]))
                    || (isset($tr_planet[4]['phase']['4-0']) && in_array($tr_planet[4]['phase']['4-0'],[0,90,180]))))
                ||
                ($na_planets[1]['in_house_id'] == 9
                    && ((isset($tr_planet[0]['phase']['0-1']) && in_array($tr_planet[0]['phase']['0-1'],[0,90,180]))
                        || (isset($tr_planet[1]['phase']['1-1']) && in_array($tr_planet[1]['phase']['1-1'],[0,90,180]))
                        || (isset($tr_planet[2]['phase']['2-1']) && in_array($tr_planet[2]['phase']['2-1'],[0,90,180]))
                        || (isset($tr_planet[4]['phase']['4-1']) && in_array($tr_planet[4]['phase']['4-1'],[0,90,180]))))
            )
            {
                $score_1_tr += 1.5;
            }
        }
        // 本命日或月9宫，与tr木星刑冲合+0.3，若此时与tr日月水火合刑冲+1.5
        if(($na_planets[0]['in_house_id'] == 9 && isset($tr_planet[5]['phase']['5-0']) && in_array($tr_planet[5]['phase']['5-0'],[0,90,180]))
            || ($na_planets[1]['in_house_id'] == 9 && isset($tr_planet[5]['phase']['5-1']) && in_array($tr_planet[5]['phase']['5-1'],[0,90,180])))
        {
            $score_1_tr += 0.3;
            if(($na_planets[0]['in_house_id'] == 9
                    && ((isset($tr_planet[0]['phase']['0-0']) && in_array($tr_planet[0]['phase']['0-0'],[0,90,180]))
                        || (isset($tr_planet[1]['phase']['1-0']) && in_array($tr_planet[1]['phase']['1-0'],[0,90,180]))
                        || (isset($tr_planet[2]['phase']['2-0']) && in_array($tr_planet[2]['phase']['2-0'],[0,90,180]))
                        || (isset($tr_planet[4]['phase']['4-0']) && in_array($tr_planet[4]['phase']['4-0'],[0,90,180]))))
                ||
                ($na_planets[1]['in_house_id'] == 9
                    && ((isset($tr_planet[0]['phase']['0-1']) && in_array($tr_planet[0]['phase']['0-1'],[0,90,180]))
                        || (isset($tr_planet[1]['phase']['1-1']) && in_array($tr_planet[1]['phase']['1-1'],[0,90,180]))
                        || (isset($tr_planet[2]['phase']['2-1']) && in_array($tr_planet[2]['phase']['2-1'],[0,90,180]))
                        || (isset($tr_planet[4]['phase']['4-1']) && in_array($tr_planet[4]['phase']['4-1'],[0,90,180]))))
            )
            {
                $score_1_tr += 1.5;
            }
        }

        #感悟人生
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tp月亮9宫与水成相+0.5
        if($tp_planet[1]['in_house_id'] == 9 && isset($tp_planet[1]['phase']['1-2']))
        {
            $score_2_tp += 0.5;
        }
        // tp月亮9宫与木成相+0.5
        if($tp_planet[1]['in_house_id'] == 9 && isset($tp_planet[1]['phase']['1-5']))
        {
            $score_2_tp += 0.5;
        }
        // tp水或木9宫与月亮成相+0.5
        if(($tp_planet[2]['in_house_id'] == 9 && isset($tp_planet[2]['phase']['2-1']))
            || ($tp_planet[5]['in_house_id'] == 9 && isset($tp_planet[5]['phase']['5-1'])))
        {
            $score_2_tp += 0.5;
        }
        // tr月亮9宫+0.5，与本命水木日金月成相+0.5（叠加）
        if($tr_planet[1]['in_house_id'] == 9)
        {
            $score_2_tr += 0.5;
            if(isset($tr_planet[1]['phase']['1-0']))
            {
                $score_2_tr += 0.5;
            }
            if(isset($tr_planet[1]['phase']['1-1']))
            {
                $score_2_tr += 0.5;
            }
            if(isset($tr_planet[1]['phase']['1-2']))
            {
                $score_2_tr += 0.5;
            }
            if(isset($tr_planet[1]['phase']['1-3']))
            {
                $score_2_tr += 0.5;
            }
            if(isset($tr_planet[1]['phase']['1-5']))
            {
                $score_2_tr += 0.5;
            }
        }

        #求神许愿
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tr本日发生新月，且tr日月金水火之一在9宫+2，若此时tr木9宫+1
        if($this->sunDeg > -1
            && ($tr_planet[0]['in_house_id'] == 9 || $tr_planet[1]['in_house_id'] == 9 || $tr_planet[2]['in_house_id'] == 9 || $tr_planet[3]['in_house_id'] == 9 || $tr_planet[4]['in_house_id'] == 9))
        {
            $score_3_tr += 2;
            if($tr_planet[5]['in_house_id'] == 9)
            {
                $score_3_tr += 1;
            }
        }
        // tr本日发生新月，且tr木星或海王1宫+2
        if(isset($tx_planet[0]['phase']['0-1']) && $tx_planet[0]['phase']['0-1']['phase_e'] == 0
            && ($tr_planet[5]['in_house_id'] == 1 || $tr_planet[8]['in_house_id'] == 1))
        {
            $score_3_tr += 2;
        }

        #出远门
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #感悟人生
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #求神许愿
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '出远门',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '感悟人生',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '求神许愿',
            'per' => $score_3,
        ];
    }
    protected function getKeywordsByHouse10()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据

        #举办庆典
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp日木成相，或金土三六分，或金木成相，且tp月合拱六分水星或金星或木星+0.4，若此时月亮在7/10宫+0.6
        if(
            (
                isset($tp_planet[0]['phase']['0-5'])
                || (isset($tp_planet[3]['phase']['3-6']) && in_array($tp_planet[3]['phase']['3-6']['phase_e'],[60,120]))
                || isset($tp_planet[3]['phase']['3-5'])
            )
            &&
            (
                (isset($tp_planet[1]['phase']['1-2']) && in_array($tp_planet[1]['phase']['1-2']['phase_e'],[0,60,120]))
                || (isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
                || (isset($tp_planet[1]['phase']['1-5']) && in_array($tp_planet[1]['phase']['1-5']['phase_e'],[0,60,120]))
            )
        )
        {
            $score_1_tp += 0.4;
            if(in_array($tp_planet[1]['in_house_id'],[7,10]))
            {
                $score_1_tp += 0.6;
            }
        }

        #谋划未来
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tp月亮过10宫与土星、海王、天王之一合刑冲+0.5（叠加）
        if($tp_planet[1]['in_house_id'] == 10)
        {
            if(isset($tp_planet[1]['phase']['1-6']) && in_array($tp_planet[1]['phase']['1-6']['phase_e'],[0,90,180]))
            {
                $score_2_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-7']) && in_array($tp_planet[1]['phase']['1-7']['phase_e'],[0,90,180]))
            {
                $score_2_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-8']) && in_array($tp_planet[1]['phase']['1-8']['phase_e'],[0,90,180]))
            {
                $score_2_tp += 0.5;
            }
        }
        // tp月亮过10宫与日金水木之一合拱六分+0.4（叠加）
        if($tp_planet[1]['in_house_id'] == 10)
        {
            if(isset($tp_planet[1]['phase']['1-0']) && in_array($tp_planet[1]['phase']['1-0']['phase_e'],[0,60,120]))
            {
                $score_2_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-2']) && in_array($tp_planet[1]['phase']['1-2']['phase_e'],[0,60,120]))
            {
                $score_2_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
            {
                $score_2_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-5']) && in_array($tp_planet[1]['phase']['1-5']['phase_e'],[0,60,120]))
            {
                $score_2_tp += 0.5;
            }
        }
        // tr月亮10宫与水或木成相+1
        if($tr_planet[1]['in_house_id'] == 10 && (isset($tr_planet[1]['phase']['1-2']) || isset($tr_planet[1]['phase']['1-5'])))
        {
            $score_2_tr += 1;
        }
        //  tr水或木10宫与本命月亮成相+0.6
        if(($tr_planet[2]['in_house_id'] == 10 && isset($tr_planet[2]['phase']['2-1']))
            || ($tr_planet[5]['in_house_id'] == 10 && isset($tr_planet[5]['phase']['5-1'])))
        {
            $score_2_tr += 0.6;
        }

        #举办庆典
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #谋划未来
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '举办庆典',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '谋划未来',
            'per' => $score_2,
        ];
    }
    protected function getKeywordsByHouse11()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据

        #参加聚会
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // tp月亮11宫与木、金之一成相+0.5（叠加），此时金水或水木或月水成相+0.4
        if($tp_planet[1]['in_house_id'] == 11)
        {
            if(isset($tp_planet[1]['phase']['1-3']))
            {
                $score_1_tp += 0.5;
            }
            if(isset($tp_planet[1]['phase']['1-5']))
            {
                $score_1_tp += 0.5;
            }
            if($score_1_tp >= 0.5
                && isset($tp_planet[3]['phase']['3-2'])
                && isset($tp_planet[2]['phase']['2-5'])
                && isset($tp_planet[1]['phase']['1-2']))
            {
                $score_1_tp += 0.4;
            }
        }
        // tr月亮11宫与木金之一成相+1，此时金星、水星同时激活+0.8，同时活跃+1.5
        if($tr_planet[1]['in_house_id'] == 11 && (isset($tr_planet[1]['phase']['1-3']) || isset($tr_planet[1]['phase']['1-5'])))
        {
            $score_1_tr += 1;
            if($this->isActive(2) == 1 && $this->isActive(3) == 1)
            {
                $score_1_tr += 0.8;
            }
            elseif($this->isActive(2) > 1 && $this->isActive(3) > 1)
            {
                $score_1_tr += 1.5;
            }
        }

        #参加聚会
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '参加聚会',
            'per' => $score_1,
        ];
    }
    protected function getKeywordsByHouse12()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planets = $this->natalData['planets'];

        #冥想
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // [前置条件]tr水星12宫+0.5
            // 此时水星与本命木星成相+2
            // 水星与本命水星成相+1.5
            // 水星与本命金日海成相+1
        if($tr_planet[2]['in_house_id'] == 12)
        {
            $score_1_tr += 0.5;
            if(isset($tr_planet[2]['phase']['2-5']))
            {
                $score_1_tr += 2;
            }
            if(isset($tr_planet[2]['phase']['2-2']))
            {
                $score_1_tr += 1.5;
            }
            if(isset($tr_planet[2]['phase']['2-0']) || isset($tr_planet[2]['phase']['2-3']) || isset($tr_planet[2]['phase']['2-8']))
            {
                $score_1_tr += 1;
            }
        }
        // tr日金月入12宫与本命水星成相+1.5
        if(
            ($tr_planet[0]['in_house_id'] == 12 && isset($tr_planet[0]['phase']['0-2']))
            || ($tr_planet[1]['in_house_id'] == 12 && isset($tr_planet[1]['phase']['1-2']))
            || ($tr_planet[3]['in_house_id'] == 12 && isset($tr_planet[3]['phase']['3-2']))
        )
        {
            $score_1_tr += 1.5;
        }
        // tp月亮在12宫与水星成相+0.5
        if($tp_planet[1]['in_house_id'] == 12 && isset($tp_planet[1]['phase']['1-2']))
        {
            $score_1_tp += 0.5;
        }

        #修仙
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // 本命12宫有个人星两颗以上，tr日12宫与本命天海成相+3
        $self_planet_num = 0;
        if($na_planets[0]['in_house_id'] == 12)
        {
            $self_planet_num++;
        }
        if($na_planets[1]['in_house_id'] == 12)
        {
            $self_planet_num++;
        }
        if($na_planets[2]['in_house_id'] == 12)
        {
            $self_planet_num++;
        }
        if($na_planets[3]['in_house_id'] == 12)
        {
            $self_planet_num++;
        }
        if($na_planets[4]['in_house_id'] == 12)
        {
            $self_planet_num++;
        }
        if($self_planet_num >= 2 && $tr_planet[0]['in_house_id'] == 12
            && (isset($tr_planet[0]['phase']['0-7']) || isset($tr_planet[0]['phase']['0-8'])))
        {
            $score_2_tr += 3;
        }

        #深刻反思
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tr水星12与本命土冥成相+3
        if($tr_planet[2]['in_house_id'] == 12 && (isset($tr_planet[2]['phase']['2-6']) || isset($tr_planet[2]['phase']['2-9'])))
        {
            $score_3_tr += 3;
        }
        // tr日月金在12宫与土冥成相+1.5
        if(
            ($tr_planet[0]['in_house_id'] == 12 && (isset($tr_planet[0]['phase']['0-6']) || isset($tr_planet[0]['phase']['0-9'])))
            || ($tr_planet[1]['in_house_id'] == 12 && (isset($tr_planet[1]['phase']['1-6']) || isset($tr_planet[1]['phase']['1-9'])))
            || ($tr_planet[3]['in_house_id'] == 12 && (isset($tr_planet[3]['phase']['3-6']) || isset($tr_planet[3]['phase']['3-9'])))
        )
        {
            $score_3_tr += 1.5;
        }
        // tp月亮与土冥成相位+0.5
        if(isset($tp_planet[1]['phase']['1-6']) || isset($tp_planet[1]['phase']['1-9']))
        {
            $score_3_tp += 0.5;
        }

        #做慈善
        $score_4_tr = $score_4_tp = $score_4_tx = 0;
        // tr金星12宫与本命日金木合拱六分+3
        if($tr_planet[3]['in_house_id'] == 12
            &&
            (
                (isset($tr_planet[3]['phase']['3-0']) && in_array($tr_planet[3]['phase']['3-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-3']) && in_array($tr_planet[3]['phase']['3-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-5']) && in_array($tr_planet[3]['phase']['3-5']['phase_e'],[0,60,120]))
            )
        )
        {
            $score_4_tr += 3;
        }
        // tr日/月/水与本命金星合拱六分+1.5
        if(
            (isset($tr_planet[0]['phase']['0-3']) && in_array($tr_planet[0]['phase']['0-3']['phase_e'],[0,60,120]))
            || (isset($tr_planet[1]['phase']['1-3']) && in_array($tr_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
            || (isset($tr_planet[2]['phase']['2-3']) && in_array($tr_planet[2]['phase']['2-3']['phase_e'],[0,60,120]))
        )
        {
            $score_4_tr += 1.5;
        }
        // tp月亮12宫与金星合拱六分+0.5
        if($tp_planet[1]['in_house_id'] == 12 && isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
        {
            $score_4_tr += 0.5;
        }

        #休养生息
        $score_5_tr = $score_5_tp = $score_5_tx = 0;
        // tr日月金水火每多一颗落入12宫+0.6
        if($tr_planet[0]['in_house_id'] == 12)
        {
            $score_5_tr += 0.6;
        }
        if($tr_planet[1]['in_house_id'] == 12)
        {
            $score_5_tr += 0.6;
        }
        if($tr_planet[2]['in_house_id'] == 12)
        {
            $score_5_tr += 0.6;
        }
        if($tr_planet[3]['in_house_id'] == 12)
        {
            $score_5_tr += 0.6;
        }
        if($tr_planet[4]['in_house_id'] == 12)
        {
            $score_5_tr += 0.6;
        }

        #冥想
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #修仙
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #深刻反思
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
        #做慈善
        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
        if($score_4_tr && $score_4_tp) $score_4 += 2;
        #休养生息
        $score_5 = $score_5_tr + $score_5_tp + $score_5_tx;
        if($score_5_tr && $score_5_tp) $score_5 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '冥想',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '修仙',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '深刻反思',
            'per' => $score_3,
        ];
        if($score_4 > 0) $this->keywords[] = [
            'text' => '做慈善',
            'per' => $score_4,
        ];
        if($score_5 > 0) $this->keywords[] = [
            'text' => '休养生息',
            'per' => $score_5,
        ];
    }
    protected function getKeywordsByOthers()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据

        #庆祝生日
        $score_1_tr = $score_1_tp = $score_1_tx = 0;
        // 当天与本命盘生日为同一天
        if(date('m-d',$this->time) == date('m-d',$this->birthtime))
        {
            $score_1_tr += 10;
        }

        #情人欢聚
        $score_2_tr = $score_2_tp = $score_2_tx = 0;
        // tr日金水与本命金星成相，每个+0.5
        if(isset($tr_planet[0]['phase']['0-3']))
        {
            $score_2_tr += 0.5;
        }
        if(isset($tr_planet[3]['phase']['3-3']))
        {
            $score_2_tr += 0.5;
        }
        if(isset($tr_planet[2]['phase']['2-3']))
        {
            $score_2_tr += 0.5;
        }
        // tr日金水在5或7宫，与本命日金水火木成合拱六分，每个+0.5
        if(in_array($tr_planet[0]['in_house_id'],[5,7]))
        {
            if((isset($tr_planet[0]['phase']['0-0']) && in_array($tr_planet[0]['phase']['0-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-2']) && in_array($tr_planet[0]['phase']['0-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-3']) && in_array($tr_planet[0]['phase']['0-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-4']) && in_array($tr_planet[0]['phase']['0-4']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-5']) && in_array($tr_planet[0]['phase']['0-5']['phase_e'],[0,60,120]))
            )
            {
                $score_2_tr += 0.5;
            }
        }
        if(in_array($tr_planet[2]['in_house_id'],[5,7]))
        {
            if((isset($tr_planet[2]['phase']['2-0']) && in_array($tr_planet[2]['phase']['2-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-2']) && in_array($tr_planet[2]['phase']['2-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-3']) && in_array($tr_planet[2]['phase']['2-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-4']) && in_array($tr_planet[2]['phase']['2-4']['phase_e'],[0,60,120]))
                || (isset($tr_planet[2]['phase']['2-5']) && in_array($tr_planet[2]['phase']['2-5']['phase_e'],[0,60,120]))
            )
            {
                $score_2_tr += 0.5;
            }
        }
        if(in_array($tr_planet[3]['in_house_id'],[5,7]))
        {
            if((isset($tr_planet[3]['phase']['3-0']) && in_array($tr_planet[3]['phase']['3-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-2']) && in_array($tr_planet[3]['phase']['3-2']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-3']) && in_array($tr_planet[3]['phase']['3-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-4']) && in_array($tr_planet[3]['phase']['3-4']['phase_e'],[0,60,120]))
                || (isset($tr_planet[3]['phase']['3-5']) && in_array($tr_planet[3]['phase']['3-5']['phase_e'],[0,60,120]))
            )
            {
                $score_2_tr += 0.5;
            }
        }
        // tr月亮在5/7与本命金木合拱六分+1
        if(in_array($tr_planet[1]['in_house_id'],[5,7])
            &&
            (
                (isset($tr_planet[1]['phase']['1-3']) && in_array($tr_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
                || (isset($tr_planet[1]['phase']['1-5']) && in_array($tr_planet[1]['phase']['1-5']['phase_e'],[0,60,120]))
            )
        )
        {
            $score_2_tr += 1;
        }
        // tp月亮不与金木成相且不在5/7宫，且，金星不在1/5/7宫，且金星不合轴，-2
        if(
            !isset($tp_planet[1]['phase']['1-3']) && !isset($tp_planet[1]['phase']['1-5'])
            && !in_array($tp_planet[1]['in_house_id'],[5,7])
            && !in_array($tp_planet[3]['in_house_id'],[1,5,7])
            && (!isset($tp_planet[3]['phase']['3-'.ASC]) || !in_array($tp_planet[3]['phase']['3-'.ASC]['phase_e'],[0,180]))
            && (!isset($tp_planet[3]['phase']['3-'.MC]) || !in_array($tp_planet[3]['phase']['3-'.MC]['phase_e'],[0,180]))
        )
        {
            $score_2_tp -= 2;
        }

        #开业
        $score_3_tr = $score_3_tp = $score_3_tx = 0;
        // tr太阳在1/10/11宫与本命木星合拱六分+2.5
        if(in_array($tr_planet[0]['in_house_id'],[1,10,11])
            && isset($tr_planet[0]['phase']['0-5'])
            && in_array($tr_planet[0]['phase']['0-5']['phase_e'],[0,60,120]))
        {
            $score_3_tr += 2.5;
        }
        // tr太阳在1/10/11宫与本命日金合拱六分，同时有tr金水月与本命木星成相+2.5
        if(in_array($tr_planet[0]['in_house_id'],[1,10,11])
            &&
            (
                (isset($tr_planet[0]['phase']['0-0']) && in_array($tr_planet[0]['phase']['0-0']['phase_e'],[0,60,120]))
                || (isset($tr_planet[0]['phase']['0-3']) && in_array($tr_planet[0]['phase']['0-3']['phase_e'],[0,60,120]))
            )
            &&
            (
                isset($tr_planet[1]['phase']['1-5'])
                || isset($tr_planet[2]['phase']['2-5'])
                || isset($tr_planet[3]['phase']['3-5'])
            )
        )
        {
            $score_3_tr += 2.5;
        }
        // tp月亮过10宫与金木日水成合拱六分+0.6
        if($tp_planet[1]['in_house_id'] == 10
            &&
            (
                (isset($tp_planet[1]['phase']['1-0']) && in_array($tp_planet[1]['phase']['1-0']['phase_e'],[0,60,120]))
                || (isset($tp_planet[1]['phase']['1-2']) && in_array($tp_planet[1]['phase']['1-2']['phase_e'],[0,60,120]))
                || (isset($tp_planet[1]['phase']['1-3']) && in_array($tp_planet[1]['phase']['1-3']['phase_e'],[0,60,120]))
                || (isset($tp_planet[1]['phase']['1-5']) && in_array($tp_planet[1]['phase']['1-5']['phase_e'],[0,60,120]))
            )
        )
        {
            $score_3_tp += 0.6;
        }

//        #结婚 20181110 去掉该项
//        $score_4_tr = $score_4_tp = $score_4_tx = 0;
//        // [前置条件]tp金木成相，且月亮过角宫或月亮过5/11宫或月金成相或月木成相，且金星不与天海合刑冲
//            // tr金星过轴+3
//            // tr金星与本命日月金木成合刑冲+2
//            // tr金星在1/5/7宫与本命星体成非刑相+0.5
//            // tr月亮在5/7宫与本命成合拱六分+0.5
//        if(
//            isset($tp_planet[3]['phase']['3-5'])
//            &&
//            (
//                $tp_planet[1]['in_house_id'] % 3 == 1
//                || in_array($tp_planet[1]['in_house_id'],[5,11])
//                || isset($tp_planet[1]['phase']['1-3'])
//                || isset($tp_planet[1]['phase']['1-5'])
//            )
//            &&
//            (
//                (!isset($tp_planet[3]['phase']['3-7']) || !in_array($tp_planet[3]['phase']['3-7']['phase_e'],[0,90,180]))
//                && (!isset($tp_planet[3]['phase']['3-8']) || !in_array($tp_planet[3]['phase']['3-8']['phase_e'],[0,90,180]))
//            )
//        )
//        {
//            if((isset($tr_planet[3]['phase']['3-'.ASC]) && in_array($tr_planet[3]['phase']['3-'.ASC]['phase_e'],[0,180]))
//            || (isset($tr_planet[3]['phase']['3-'.MC]) && in_array($tr_planet[3]['phase']['3-'.MC]['phase_e'],[0,180])))
//            {
//                $score_4_tr += 3;
//            }
//            if(
//                (isset($tr_planet[3]['phase']['3-0']) && in_array($tr_planet[3]['phase']['3-0']['phase_e'],[0,90,180]))
//                || (isset($tr_planet[3]['phase']['3-1']) && in_array($tr_planet[3]['phase']['3-1']['phase_e'],[0,90,180]))
//                || (isset($tr_planet[3]['phase']['3-3']) && in_array($tr_planet[3]['phase']['3-3']['phase_e'],[0,90,180]))
//                || (isset($tr_planet[3]['phase']['3-5']) && in_array($tr_planet[3]['phase']['3-5']['phase_e'],[0,90,180]))
//            )
//            {
//                $score_4_tr += 2;
//            }
//            if(in_array($tr_planet[3]['in_house_id'],[1,5,7]))
//            {
//                if(!empty($tr_planet[3]['phase']))
//                {
//                    $phase3_un90_num = 0;
//                    foreach ($tr_planet[3]['phase'] as $phase3)
//                    {
//                        if($phase3['id'] <= 9 && $phase3['phase_e'] != 90)
//                        {
//                            $phase3_un90_num++;
//                        }
//                    }
//                    if($phase3_un90_num > 0)
//                    {
//                        $score_4_tr += 0.5;
//                    }
//                }
//            }
//            if(in_array($tr_planet[1]['in_house_id'],[5,7]))
//            {
//                if(!empty($tr_planet[3]['phase']))
//                {
//                    $phase1_060120_num = 0;
//                    foreach ($tr_planet[3]['phase'] as $phase1)
//                    {
//                        if($phase1['id'] <= 9 && in_array($phase1['phase_e'],[0,60,120]))
//                        {
//                            $phase1_060120_num++;
//                        }
//                    }
//                    if($phase1_060120_num > 0)
//                    {
//                        $score_4_tr += 0.5;
//                    }
//                }
//            }
//        }

        #庆祝生日
        $score_1 = $score_1_tr + $score_1_tp + $score_1_tx;
        if($score_1_tr && $score_1_tp) $score_1 += 2;
        #情人欢聚
        $score_2 = $score_2_tr + $score_2_tp + $score_2_tx;
        if($score_2_tr && $score_2_tp) $score_2 += 2;
        #开业
        $score_3 = $score_3_tr + $score_3_tp + $score_3_tx;
        if($score_3_tr && $score_3_tp) $score_3 += 2;
//        #结婚
//        $score_4 = $score_4_tr + $score_4_tp + $score_4_tx;
//        if($score_4_tr && $score_4_tp) $score_4 += 2;

        if($score_1 > 0) $this->keywords[] = [
            'text' => '庆祝生日',
            'per' => $score_1,
        ];
        if($score_2 > 0) $this->keywords[] = [
            'text' => '情人欢聚',
            'per' => $score_2,
        ];
        if($score_3 > 0) $this->keywords[] = [
            'text' => '开业',
            'per' => $score_3,
        ];
//        if($score_4 > 0) $this->keywords[] = [
//            'text' => '结婚',
//            'per' => $score_4,
//        ];
    }

    /**
     * 激活、活跃：tr中，本命日月水金火与流年日月水金火成相，成相一次为激活，两次以上为活跃
     * @param int $pid
     * @return int
     */
    private function isActive(int $pid)
    {
        $tn_planets = $this->transitsData[0];
        $planets = [0,1,2,3,4];

        $phase_num = 0;
        if(in_array($pid,$planets))
        {
            if(!empty($tn_planets[$pid]['phase']))
            {
                foreach ($tn_planets[$pid]['phase'] as $phase)
                {
                    if(in_array($phase['id'],$planets))
                    {
                        $phase_num++;
                    }
                }
            }
        }
        return $phase_num;
    }
}